summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/charge_state.h4
-rw-r--r--include/chipset.h6
-rw-r--r--include/common.h32
-rw-r--r--include/config.h24
-rw-r--r--include/console.h2
-rw-r--r--include/cros_board_info.h6
-rw-r--r--include/cros_version.h2
-rw-r--r--include/driver/retimer/anx7483_public.h34
-rw-r--r--include/ec_commands.h23
-rw-r--r--include/host_command.h2
-rw-r--r--include/mkbp_info.h22
-rw-r--r--include/power.h7
-rw-r--r--include/rgb_keyboard.h22
-rw-r--r--include/timer.h9
14 files changed, 150 insertions, 45 deletions
diff --git a/include/charge_state.h b/include/charge_state.h
index 9349c3ea4c..ed777c1a64 100644
--- a/include/charge_state.h
+++ b/include/charge_state.h
@@ -96,17 +96,15 @@ int charge_keep_power_off(void);
*/
uint32_t charge_get_flags(void);
-#if defined(CONFIG_CHARGER)
/**
* Return current battery charge percentage.
*/
int charge_get_percent(void);
-#elif defined(CONFIG_BATTERY)
+
/**
* Return current battery charge if not using charge manager sub-system.
*/
int board_get_battery_soc(void);
-#endif
/**
* Return current display charge in 10ths of a percent (e.g. 1000 = 100.0%)
diff --git a/include/chipset.h b/include/chipset.h
index 51a9018dfb..840db3aa60 100644
--- a/include/chipset.h
+++ b/include/chipset.h
@@ -48,7 +48,7 @@ enum critical_shutdown {
CRITICAL_SHUTDOWN_CUTOFF,
};
-#if defined(HAS_TASK_CHIPSET) || defined(CONFIG_ZEPHYR)
+#ifdef CONFIG_AP_POWER_CONTROL
/**
* Check if chipset is in a given state.
@@ -125,7 +125,7 @@ void chipset_pre_init_callback(void);
*/
void init_reset_log(void);
-#else /* !HAS_TASK_CHIPSET */
+#else /* !CONFIG_AP_POWER_CONTROL */
/* When no chipset is present, assume it is always off. */
static inline int chipset_in_state(int state_mask)
@@ -156,7 +156,7 @@ static inline void chipset_watchdog_interrupt(enum gpio_signal signal) { }
static inline void init_reset_log(void) { }
-#endif /* !HAS_TASK_CHIPSET */
+#endif /* !CONFIG_AP_POWER_CONTROL */
/**
* Optional chipset check if PLTRST# is valid.
diff --git a/include/common.h b/include/common.h
index 33c9ab97c2..02989c692b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -238,6 +238,22 @@
return error; \
} while (0)
+/*
+ * Define test_mockable and test_mockable_static for mocking
+ * functions.
+ */
+#ifdef TEST_BUILD
+#define test_mockable __attribute__((weak))
+#define test_mockable_static __attribute__((weak))
+#define test_mockable_static_inline __attribute__((weak))
+#define test_export_static
+#else
+#define test_mockable
+#define test_mockable_static static
+#define test_mockable_static_inline static inline
+#define test_export_static static
+#endif
+
/* Include top-level configuration file */
#include "config.h"
@@ -336,22 +352,6 @@ enum ec_error_list {
};
/*
- * Define test_mockable and test_mockable_static for mocking
- * functions.
- */
-#ifdef TEST_BUILD
-#define test_mockable __attribute__((weak))
-#define test_mockable_static __attribute__((weak))
-#define test_mockable_static_inline __attribute__((weak))
-#define test_export_static
-#else
-#define test_mockable
-#define test_mockable_static static
-#define test_mockable_static_inline static inline
-#define test_export_static static
-#endif
-
-/*
* Attribute to define functions to only be used in test code, causing
* a compiler error if used without TEST_BUILD defined.
*
diff --git a/include/config.h b/include/config.h
index b19f76f614..523d94a8a8 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2879,6 +2879,18 @@
#undef CONFIG_IT83XX_VCC_3P3V
/*
+ * Overwrite integer multiplication and division arithmetic library routines
+ * with using hardware multiplication and division and nop instructions.
+ */
+#undef CONFIG_IT8XXX2_MUL_WORKAROUND
+
+/*
+ * Support the standard integer multiplication and division instruction
+ * extension.
+ */
+#define CONFIG_RISCV_EXTENSION_M
+
+/*
* If this is not defined, the firmware will revert the JTAG selection
* triggered by the hardware strap pin.
* Un-define this flag by default for all real platforms. see (b/129908668)
@@ -3150,6 +3162,7 @@
#undef CONFIG_LED_DRIVER_IS31FL3733B /* Lumissil IS31FL3733B on I2C */
#undef CONFIG_LED_DRIVER_IS31FL3743B /* Lumissil IS31FL3743B on SPI */
#undef CONFIG_LED_DRIVER_AW20198 /* Awinic AW20198 on I2C */
+#undef CONFIG_LED_DRIVER_TLC59116F /* TLC59116F on I2C */
/* Enable late init for is31fl3743b. Work around b:232443638. */
#undef CONFIG_IS31FL3743B_LATE_INIT
@@ -6266,6 +6279,17 @@
#endif
/*
+ * If the chipset task is enabled, this implies there is an AP to manage power
+ * for. In Zephyr this can be implied by multiple options, so we provide the
+ * same symbol here instead of making code examine HAS_TASK_CHIPSET.
+ */
+#ifndef CONFIG_AP_POWER_CONTROL
+#ifdef HAS_TASK_CHIPSET
+#define CONFIG_AP_POWER_CONTROL
+#endif /* HAS_TASK_CHIPSET */
+#endif /* CONFIG_AP_POWER_CONTROL */
+
+/*
* If a board has a chipset task, set the minimum charger power required for
* powering on to 15W. This is also the highest power discovered over Type-C by
* analog signaling. The EC normally does not communicate using USB PD when the
diff --git a/include/console.h b/include/console.h
index 6197b84ce2..457d24cc95 100644
--- a/include/console.h
+++ b/include/console.h
@@ -256,7 +256,7 @@ void console_has_input(void);
#define _DCL_CON_CMD_ALL(NAME, ROUTINE, ARGDESC, HELP, FLAGS) \
static int (ROUTINE)(int argc, char **argv); \
static const char __con_cmd_label_##NAME[] = #NAME; \
- _Static_assert(sizeof(__con_cmd_label_##NAME) < 16, \
+ _STATIC_ASSERT(sizeof(__con_cmd_label_##NAME) < 16, \
"command name '" #NAME "' is too long"); \
const struct console_command __keep __no_sanitize_address \
__con_cmd_##NAME \
diff --git a/include/cros_board_info.h b/include/cros_board_info.h
index 7a79cfee2a..9ed5e1777b 100644
--- a/include/cros_board_info.h
+++ b/include/cros_board_info.h
@@ -191,9 +191,9 @@ int cbi_board_override(enum cbi_data_tag tag, uint8_t *buf, uint8_t *size);
/**
* Set and update FW_CONFIG tag field
*
- * This function is only included when HAS_TASK_CHIPSET is not defined. It is
- * intended to be used for projects which want CBI functions, but do not have an
- * AP and ectool host command access.
+ * This function is only included when CONFIG_AP_POWER_CONTROL is disabled. It
+ * is intended to be used for projects which want CBI functions, but do not
+ * have an AP and ectool host command access.
*
* @param fw_config updated value for FW_CONFIG tag
* @return EC_SUCCESS to indicate the field was written correctly.
diff --git a/include/cros_version.h b/include/cros_version.h
index 585c2c1013..47fa8d1774 100644
--- a/include/cros_version.h
+++ b/include/cros_version.h
@@ -17,6 +17,8 @@
#define CROS_EC_IMAGE_DATA_COOKIE3_MASK GENMASK(31, 8)
#define CROS_EC_IMAGE_DATA_COOKIE3_VERSION GENMASK(7, 0)
+#define CROS_FWID_MISSING_STR "CROS_FWID_MISSING"
+
struct image_data {
uint32_t cookie1;
char version[32];
diff --git a/include/driver/retimer/anx7483_public.h b/include/driver/retimer/anx7483_public.h
index f7654837db..8c3b9eaf60 100644
--- a/include/driver/retimer/anx7483_public.h
+++ b/include/driver/retimer/anx7483_public.h
@@ -18,6 +18,40 @@
#define ANX7483_I2C_ADDR2_FLAGS 0x40
#define ANX7483_I2C_ADDR3_FLAGS 0x44
+/* Equalization tuning */
+enum anx7483_eq_setting {
+ ANX7483_EQ_SETTING_3_9DB = 0,
+ ANX7483_EQ_SETTING_4_7DB = 1,
+ ANX7483_EQ_SETTING_5_5DB = 2,
+ ANX7483_EQ_SETTING_6_1DB = 3,
+ ANX7483_EQ_SETTING_6_8DB = 4,
+ ANX7483_EQ_SETTING_7_3DB = 5,
+ ANX7483_EQ_SETTING_7_8DB = 6,
+ ANX7483_EQ_SETTING_8_1DB = 7,
+ ANX7483_EQ_SETTING_8_4DB = 8,
+ ANX7483_EQ_SETTING_8_7DB = 9,
+ ANX7483_EQ_SETTING_9_2DB = 10,
+ ANX7483_EQ_SETTING_9_7DB = 11,
+ ANX7483_EQ_SETTING_10_3DB = 12,
+ ANX7483_EQ_SETTING_11_1DB = 13,
+ ANX7483_EQ_SETTING_11_8DB = 14,
+ ANX7483_EQ_SETTING_12_5DB = 15,
+};
+
+enum anx7483_tune_pin {
+ ANX7483_PIN_UTX1,
+ ANX7483_PIN_UTX2,
+ ANX7483_PIN_URX1,
+ ANX7483_PIN_URX2,
+ ANX7483_PIN_DRX1,
+ ANX7483_PIN_DRX2,
+};
+
+/* Adjust the equalization for a pin */
+enum ec_error_list anx7483_set_eq(const struct usb_mux *me,
+ enum anx7483_tune_pin pin,
+ enum anx7483_eq_setting eq);
+
/* Configure datasheet defaults for tuning registers at this mux setting */
enum ec_error_list anx7483_set_default_tuning(const struct usb_mux *me,
mux_state_t mux_state);
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 3755acce19..b11b34b5fd 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -4727,7 +4727,7 @@ struct ec_params_dedicated_charger_limit {
/*
* Get and set charging splashscreen variables
*/
-#define EC_CMD_CHARGESPLASH 0x00A4
+#define EC_CMD_CHARGESPLASH 0x00A5
enum ec_chargesplash_cmd {
/* Get the current state variables */
@@ -7139,6 +7139,7 @@ struct ec_response_i2c_control {
#define EC_RGBKBD_MAX_KEY_COUNT 128
#define EC_RGBKBD_MAX_RGB_COLOR 0xFFFFFF
+#define EC_RGBKBD_MAX_SCALE 0xFF
enum rgbkbd_state {
/* RGB keyboard is reset and not initialized. */
@@ -7156,13 +7157,31 @@ enum rgbkbd_state {
enum ec_rgbkbd_subcmd {
EC_RGBKBD_SUBCMD_CLEAR = 1,
+ EC_RGBKBD_SUBCMD_DEMO = 2,
+ EC_RGBKBD_SUBCMD_SET_SCALE = 3,
EC_RGBKBD_SUBCMD_COUNT
};
+enum ec_rgbkbd_demo {
+ EC_RGBKBD_DEMO_OFF = 0,
+ EC_RGBKBD_DEMO_FLOW = 1,
+ EC_RGBKBD_DEMO_DOT = 2,
+ EC_RGBKBD_DEMO_COUNT,
+};
+
+BUILD_ASSERT(EC_RGBKBD_DEMO_COUNT <= 255);
+
+struct ec_rgbkbd_set_scale {
+ uint8_t key;
+ struct rgb_s scale;
+};
+
struct ec_params_rgbkbd {
uint8_t subcmd; /* Sub-command (enum ec_rgbkbd_subcmd) */
union {
- struct rgb_s color;
+ struct rgb_s color; /* EC_RGBKBD_SUBCMD_CLEAR */
+ uint8_t demo; /* EC_RGBKBD_SUBCMD_DEMO */
+ struct ec_rgbkbd_set_scale set_scale;
};
} __ec_align1;
diff --git a/include/host_command.h b/include/host_command.h
index 74f68f9891..3ab3d54351 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -273,7 +273,7 @@ struct host_command *zephyr_find_host_command(int command);
static enum ec_status(routine)(struct host_cmd_handler_args *args); \
const struct host_command __keep __no_sanitize_address \
EXPAND(0x0000, command) \
- __attribute__((section(".rodata.hcmds."EXPANDSTR(0x0000, command)))) \
+ __attribute__((section(".rodata.hcmds." EXPANDSTR(0x0000, command)))) \
= {routine, command, version_mask}
/*
diff --git a/include/mkbp_info.h b/include/mkbp_info.h
new file mode 100644
index 0000000000..64daa52dce
--- /dev/null
+++ b/include/mkbp_info.h
@@ -0,0 +1,22 @@
+/* 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.
+ */
+
+/* MKBP info host command for Chrome EC */
+
+#ifndef __CROS_EC_MKBP_INFO_H
+#define __CROS_EC_MKBP_INFO_H
+
+/**
+ * Board specific function to set support volume buttons.
+ *
+ * Although we're able to define CONFIG_VOLUME_BUTTONS for ec volume buttons,
+ * some boards might need to configure this settings at run time by several
+ * cases such as sharing the firmware with different designs.
+ *
+ * @return 1 if volume buttons supported else 0
+ */
+__override_proto int mkbp_support_volume_buttons(void);
+
+#endif /* __CROS_EC_MKBP_INFO_H */
diff --git a/include/power.h b/include/power.h
index 547a4d93ab..6200392b95 100644
--- a/include/power.h
+++ b/include/power.h
@@ -8,6 +8,7 @@
#ifndef __CROS_EC_POWER_H
#define __CROS_EC_POWER_H
+#include "chipset.h"
#include "common.h"
#include "compiler.h"
#include "gpio_signal.h"
@@ -173,7 +174,7 @@ void power_set_state(enum power_state new_state);
*
* @return Current chipset power state
*/
-#ifdef HAS_TASK_CHIPSET
+#ifdef CONFIG_AP_POWER_CONTROL
enum power_state power_get_state(void);
#else
static inline enum power_state power_get_state(void) {
@@ -204,11 +205,11 @@ enum power_state power_handle_state(enum power_state state);
/**
* Interrupt handler for power signal GPIOs.
*/
-#ifdef HAS_TASK_CHIPSET
+#ifdef CONFIG_AP_POWER_CONTROL
void power_signal_interrupt(enum gpio_signal signal);
#else
static inline void power_signal_interrupt(enum gpio_signal signal) { }
-#endif /* !HAS_TASK_CHIPSET */
+#endif /* !CONFIG_AP_POWER_CONTROL */
/**
* Interrupt handler for rsmrst signal GPIO. This interrupt handler should be
diff --git a/include/rgb_keyboard.h b/include/rgb_keyboard.h
index 58dc3c30f6..e795389225 100644
--- a/include/rgb_keyboard.h
+++ b/include/rgb_keyboard.h
@@ -15,12 +15,7 @@
#define RGBKBD_MAX_GCC_LEVEL 0xff
#define RGBKBD_MAX_SCALE 0xff
-enum rgbkbd_demo {
- RGBKBD_DEMO_OFF = 0,
- RGBKBD_DEMO_FLOW = 1,
- RGBKBD_DEMO_DOT = 2,
- RGBKBD_DEMO_COUNT
-};
+#define RGBKBD_CTX_TO_GRID(ctx) ((ctx) - &rgbkbds[0])
struct rgbkbd_cfg {
/* Driver for LED IC */
@@ -39,18 +34,23 @@ struct rgbkbd_init {
/* Global current control */
const uint8_t gcc;
/* LED brightness */
- const uint8_t scale;
+ const struct rgb_s scale;
/* Color */
const struct rgb_s color;
};
-extern const struct rgbkbd_init rgbkbd_default;
+/**
+ * Register init settings.
+ *
+ * Must be called before rgbkbd_drv->init() is called.
+ *
+ * @param setting
+ */
+void rgbkbd_register_init_setting(const struct rgbkbd_init *setting);
struct rgbkbd {
/* Static configuration */
const struct rgbkbd_cfg * const cfg;
- /* Start-up settings */
- const struct rgbkbd_init * const init;
/* Current state of the port */
enum rgbkbd_state state;
/* Buffer containing color info for each dot. */
@@ -86,7 +86,7 @@ struct rgbkbd_drv {
* @return enum ec_error_list
*/
int (*set_scale)(struct rgbkbd *ctx, uint8_t offset,
- uint8_t scale, uint8_t len);
+ struct rgb_s scale, uint8_t len);
/**
* Set global current control.
*
diff --git a/include/timer.h b/include/timer.h
index 340dd8c5e8..6f9b4ea7b0 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -8,6 +8,13 @@
#ifndef __CROS_EC_TIMER_H
#define __CROS_EC_TIMER_H
+#ifndef CONFIG_ZEPHYR
+#include <sys/types.h>
+#else
+/* Data type for POSIX style clock() implementation */
+typedef long clock_t;
+#endif
+
#include "common.h"
#include "task_id.h"
@@ -27,8 +34,6 @@ typedef union {
} le /* little endian words */;
} timestamp_t;
-/* Data type for POSIX style clock() implementation */
-typedef long clock_t;
/**
* Initialize the timer module.