summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/cbi.c3
-rw-r--r--common/fpsensor/fpsensor.c4
-rw-r--r--common/host_command.c6
-rw-r--r--common/host_command_controller.c4
-rw-r--r--common/host_event_commands.c1
-rw-r--r--common/keyboard_8042.c2
-rw-r--r--common/keyboard_backlight.c11
-rw-r--r--common/led_policy_std.c2
-rw-r--r--common/mkbp_info.c16
-rw-r--r--common/rgb_keyboard.c268
-rw-r--r--common/system.c8
-rw-r--r--common/usb_pd_alt_mode_dfp.c2
-rw-r--r--common/usb_pd_protocol.c2
-rw-r--r--common/usbc/usb_pd_dpm.c6
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c4
15 files changed, 209 insertions, 130 deletions
diff --git a/common/cbi.c b/common/cbi.c
index 217dffd6f4..e18f15e5a9 100644
--- a/common/cbi.c
+++ b/common/cbi.c
@@ -5,6 +5,7 @@
* Cros Board Info
*/
+#include "chipset.h"
#include "common.h"
#include "console.h"
#include "crc8.h"
@@ -546,7 +547,7 @@ DECLARE_CONSOLE_COMMAND(cbi, cc_cbi, "[set <tag> <value> <size> | "
"Print or change Cros Board Info from flash");
#endif /* CONFIG_CMD_CBI */
-#ifndef HAS_TASK_CHIPSET
+#ifndef CONFIG_AP_POWER_CONTROL
int cbi_set_fw_config(uint32_t fw_config)
{
/* Check write protect status */
diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c
index 25d416a8e2..12904c0b39 100644
--- a/common/fpsensor/fpsensor.c
+++ b/common/fpsensor/fpsensor.c
@@ -338,7 +338,7 @@ static enum ec_status fp_command_passthru(struct host_cmd_handler_args *args)
const struct ec_params_fp_passthru *params = args->params;
void *out = args->response;
int rc;
- int ret = EC_RES_SUCCESS;
+ enum ec_status ret = EC_RES_SUCCESS;
if (system_is_locked())
return EC_RES_ACCESS_DENIED;
@@ -754,7 +754,7 @@ static enum ec_error_list fp_console_action(uint32_t mode)
while (tries--) {
if (!(sensor_mode & FP_MODE_ANY_CAPTURE)) {
CPRINTS("done (events:%x)", (int)fp_events);
- return 0;
+ return EC_SUCCESS;
}
usleep(100 * MSEC);
}
diff --git a/common/host_command.c b/common/host_command.c
index 0edd188984..e05475ce48 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -660,11 +660,11 @@ static void host_command_debug_request(struct host_cmd_handler_args *args)
}
if (hcdebug >= HCDEBUG_PARAMS && args->params_size)
- CPRINTS("HC 0x%02x.%d:%ph", args->command,
+ CPRINTS("HC 0x%04x.%d:%ph", args->command,
args->version,
HEX_BUF(args->params, args->params_size));
else
- CPRINTS("HC 0x%02x", args->command);
+ CPRINTS("HC 0x%04x", args->command);
}
uint16_t host_command_process(struct host_cmd_handler_args *args)
@@ -717,7 +717,7 @@ uint16_t host_command_process(struct host_cmd_handler_args *args)
}
if (rv != EC_RES_SUCCESS)
- CPRINTS("HC 0x%02x err %d", args->command, rv);
+ CPRINTS("HC 0x%04x err %d", args->command, rv);
if (hcdebug >= HCDEBUG_PARAMS && args->response_size)
CPRINTS("HC resp:%ph",
diff --git a/common/host_command_controller.c b/common/host_command_controller.c
index befa1865a6..eb35622ab3 100644
--- a/common/host_command_controller.c
+++ b/common/host_command_controller.c
@@ -119,7 +119,7 @@ static int pd_host_command_internal(int command, int version,
/* Check for host command error code */
ret = resp_buf[0];
if (ret) {
- CPRINTS("command 0x%02x returned error %d", command, ret);
+ CPRINTS("command 0x%04x returned error %d", command, ret);
return -ret;
}
@@ -154,7 +154,7 @@ static int pd_host_command_internal(int command, int version,
if ((uint8_t)sum) {
- CPRINTS("command 0x%02x bad checksum returned: %d",
+ CPRINTS("command 0x%04x bad checksum returned: %d",
command, sum);
return -EC_RES_INVALID_CHECKSUM;
}
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 6fa1227272..177e7cb877 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -5,6 +5,7 @@
/* Host event commands for Chrome EC */
+#include "chipset.h"
#include "common.h"
#include "console.h"
#include "hooks.h"
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index da09edc91c..755b26f360 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -5,8 +5,8 @@
* 8042 keyboard protocol
*/
-#include "chipset.h"
#include "button.h"
+#include "chipset.h"
#include "common.h"
#include "console.h"
#include "device_event.h"
diff --git a/common/keyboard_backlight.c b/common/keyboard_backlight.c
index 8cf400dc34..62da361d73 100644
--- a/common/keyboard_backlight.c
+++ b/common/keyboard_backlight.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include "chipset.h"
#include "console.h"
#include "ec_commands.h"
#include "gpio.h"
@@ -113,9 +114,15 @@ static void keyboard_backlight_init(void)
/* Don't leave kblight enable state undetermined */
kblight_enable(0);
}
+#ifdef HAS_TASK_CHIPSET
+/* We're running on a system EC. Initialize kblight once per AP start-up. */
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, keyboard_backlight_init, HOOK_PRIO_DEFAULT);
+#else
+/* We're running on a KBMCU thus powered when AP starts. Do init on reset. */
DECLARE_HOOK(HOOK_INIT, keyboard_backlight_init, HOOK_PRIO_DEFAULT);
+#endif
-#ifdef HAS_TASK_CHIPSET
+#ifdef CONFIG_AP_POWER_CONTROL
static void kblight_suspend(void)
{
kblight_enable(0);
@@ -130,7 +137,7 @@ static void kblight_resume(void)
}
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, kblight_resume, HOOK_PRIO_DEFAULT);
-#endif // HAS_TASK_CHIPSET
+#endif /* CONFIG_AP_POWER_CONTROL */
#ifdef CONFIG_LID_SWITCH
static void kblight_lid_change(void)
diff --git a/common/led_policy_std.c b/common/led_policy_std.c
index b18dc1bc27..65bf8cedbd 100644
--- a/common/led_policy_std.c
+++ b/common/led_policy_std.c
@@ -124,7 +124,7 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
return EC_SUCCESS;
}
-#ifdef HAS_TASK_CHIPSET
+#ifdef CONFIG_AP_POWER_CONTROL
static void std_led_shutdown(void)
{
pwr_led_set_color(LED_OFF);
diff --git a/common/mkbp_info.c b/common/mkbp_info.c
index b3835367cf..52d26f407b 100644
--- a/common/mkbp_info.c
+++ b/common/mkbp_info.c
@@ -12,16 +12,26 @@
#include "keyboard_config.h"
#include "keyboard_mkbp.h"
#include "keyboard_scan.h"
+#include "mkbp_info.h"
#include "mkbp_input_devices.h"
#include "util.h"
+__overridable int mkbp_support_volume_buttons(void)
+{
+#ifdef CONFIG_VOLUME_BUTTONS
+ return 1;
+#else
+ return 0;
+#endif
+}
+
static uint32_t get_supported_buttons(void)
{
uint32_t val = 0;
-#ifdef CONFIG_VOLUME_BUTTONS
- val |= BIT(EC_MKBP_VOL_UP) | BIT(EC_MKBP_VOL_DOWN);
-#endif /* defined(CONFIG_VOLUME_BUTTONS) */
+ if (mkbp_support_volume_buttons()) {
+ val |= BIT(EC_MKBP_VOL_UP) | BIT(EC_MKBP_VOL_DOWN);
+ }
#ifdef CONFIG_DEDICATED_RECOVERY_BUTTON
val |= BIT(EC_MKBP_RECOVERY);
diff --git a/common/rgb_keyboard.c b/common/rgb_keyboard.c
index e77939ff9e..815e4a3435 100644
--- a/common/rgb_keyboard.c
+++ b/common/rgb_keyboard.c
@@ -23,15 +23,14 @@
#define CPRINTF(fmt, args...) cprintf(CC_RGBKBD, "RGBKBD: " fmt, ##args)
#define CPRINTS(fmt, args...) cprints(CC_RGBKBD, "RGBKBD: " fmt, ##args)
-test_export_static enum rgbkbd_demo demo =
+test_export_static enum ec_rgbkbd_demo demo =
#if defined(CONFIG_RGBKBD_DEMO_FLOW)
- RGBKBD_DEMO_FLOW
+ EC_RGBKBD_DEMO_FLOW;
#elif defined(CONFIG_RGBKBD_DEMO_DOT)
- RGBKBD_DEMO_DOT
+ EC_RGBKBD_DEMO_DOT;
#else
- RGBKBD_DEMO_OFF
+ EC_RGBKBD_DEMO_OFF;
#endif
- ;
const int default_demo_interval_ms = 250;
test_export_static int demo_interval_ms = -1;
@@ -41,31 +40,48 @@ uint8_t rgbkbd_table[EC_RGBKBD_MAX_KEY_COUNT];
static enum rgbkbd_state rgbkbd_state;
-const struct rgbkbd_init rgbkbd_default = {
+const struct rgbkbd_init rgbkbd_init_default = {
.gcc = RGBKBD_MAX_GCC_LEVEL / 2,
- .scale = RGBKBD_MAX_SCALE,
+ .scale = { RGBKBD_MAX_SCALE, RGBKBD_MAX_SCALE, RGBKBD_MAX_SCALE },
.color = { .r = 0xff, .g = 0xff, .b = 0xff }, /* white */
};
+const struct rgbkbd_init *rgbkbd_init_setting = &rgbkbd_init_default;
+
+void rgbkbd_register_init_setting(const struct rgbkbd_init *setting)
+{
+ rgbkbd_init_setting = setting;
+}
+
+/* Search the grid where x belongs to. */
+static struct rgbkbd *find_grid_from_x(int x, uint8_t *col)
+{
+ struct rgbkbd *ctx = NULL;
+ uint8_t grid;
+
+ *col = 0;
+ for (grid = 0; grid < rgbkbd_count; grid++) {
+ ctx = &rgbkbds[grid];
+ if (x < *col + ctx->cfg->col_len)
+ break;
+ *col += ctx->cfg->col_len;
+ }
+
+ return ctx;
+}
+
static int set_color_single(struct rgb_s color, int x, int y)
{
struct rgbkbd *ctx = &rgbkbds[0];
- uint8_t grid;
- uint8_t col = 0;
- uint8_t offset;
+ uint8_t grid, col, offset;
int rv;
if (rgbkbd_hsize <= x || rgbkbd_vsize <= y) {
return EC_ERROR_OVERFLOW;
}
- /* Search the grid where x belongs to. */
- for (grid = 0; grid < rgbkbd_count; grid++, ctx++) {
- if (x < col + ctx->cfg->col_len)
- break;
- col += ctx->cfg->col_len;
- }
-
+ ctx = find_grid_from_x(x, &col);
+ grid = RGBKBD_CTX_TO_GRID(ctx);
offset = ctx->cfg->row_len * (x - col) + y;
ctx->buf[offset] = color;
@@ -183,16 +199,16 @@ static void rgbkbd_demo_dot(void)
#endif
}
-static void rgbkbd_demo_run(enum rgbkbd_demo id)
+static void rgbkbd_demo_run(enum ec_rgbkbd_demo id)
{
switch (id) {
- case RGBKBD_DEMO_FLOW:
+ case EC_RGBKBD_DEMO_FLOW:
rgbkbd_demo_flow();
break;
- case RGBKBD_DEMO_DOT:
+ case EC_RGBKBD_DEMO_DOT:
rgbkbd_demo_dot();
break;
- case RGBKBD_DEMO_OFF:
+ case EC_RGBKBD_DEMO_OFF:
default:
break;
}
@@ -264,7 +280,7 @@ static int rgbkbd_set_global_brightness(uint8_t gcc)
return rv;
}
-static int rgbkbd_set_scale(uint8_t scale)
+static int rgbkbd_reset_scale(struct rgb_s scale)
{
int e, i, rv = EC_SUCCESS;
@@ -273,8 +289,8 @@ static int rgbkbd_set_scale(uint8_t scale)
e = ctx->cfg->drv->set_scale(ctx, 0, scale, get_grid_size(ctx));
if (e) {
- CPRINTS("Failed to set scale of GRID%d to %d (%d)",
- i, scale, e);
+ CPRINTS("Failed to set scale to [%d,%d,%d] Grid%d (%d)",
+ scale.r, scale.g, scale.b, i, e);
rv = e;
}
}
@@ -282,6 +298,46 @@ static int rgbkbd_set_scale(uint8_t scale)
return rv;
}
+static int rgbkbd_set_scale(struct rgb_s scale, uint8_t key)
+{
+ struct rgbkbd *ctx;
+ uint8_t j, col, grid, offset;
+ union rgbkbd_coord_u8 led;
+ int rv = EC_SUCCESS;
+
+ j = rgbkbd_table[key];
+ if (j == RGBKBD_NONE)
+ return rv;
+
+ do {
+ led.u8 = rgbkbd_map[j++];
+ if (led.u8 == RGBKBD_DELM)
+ /* Reached end of the group. */
+ break;
+ ctx = find_grid_from_x(led.coord.x, &col);
+ grid = RGBKBD_CTX_TO_GRID(ctx);
+ /*
+ * offset is the relative position in our buffer where LED
+ * colors are cached. RGB is grouped as one. Note this differs
+ * from the external buffer (LED drivers' buffer) where RGB is
+ * individually counted.
+ *
+ * offset can be calculated by multiplying the horizontal
+ * position (x) by the size of the rows, then, adding the
+ * vertical position (y).
+ */
+ offset = ctx->cfg->row_len * (led.coord.x - col) + led.coord.y;
+ rv = ctx->cfg->drv->set_scale(ctx, offset, scale, 1);
+ if (rv) {
+ CPRINTS("Failed to set scale to [%d,%d,%d] Grid%d (%d)",
+ scale.r, scale.g, scale.b, grid, rv);
+ return rv;
+ }
+ } while (led.u8 != RGBKBD_DELM);
+
+ return rv;
+}
+
static int rgbkbd_init(void)
{
int rv = EC_SUCCESS;
@@ -289,8 +345,7 @@ static int rgbkbd_init(void)
for (i = 0; i < rgbkbd_count; i++) {
struct rgbkbd *ctx = &rgbkbds[i];
- uint8_t scale = ctx->init->scale;
- uint8_t gcc = ctx->init->gcc;
+ uint8_t gcc = rgbkbd_init_setting->gcc;
e = ctx->cfg->drv->init(ctx);
if (e) {
@@ -299,14 +354,6 @@ static int rgbkbd_init(void)
continue;
}
- e = ctx->cfg->drv->set_scale(ctx, 0, scale, get_grid_size(ctx));
- if (e) {
- CPRINTS("Failed to set scale of GRID%d to %d (%d)",
- i, scale, rv);
- rv = e;
- continue;
- }
-
e = ctx->cfg->drv->set_gcc(ctx, gcc);
if (e) {
CPRINTS("Failed to set GCC to %u for grid=%d (%d)",
@@ -315,11 +362,12 @@ static int rgbkbd_init(void)
continue;
}
- rgbkbd_reset_color(ctx->init->color);
-
CPRINTS("Initialized GRID%d", i);
}
+ rv |= rgbkbd_reset_scale(rgbkbd_init_setting->scale);
+ rgbkbd_reset_color(rgbkbd_init_setting->color);
+
if (rv == EC_SUCCESS)
rgbkbd_state = RGBKBD_STATE_INITIALIZED;
@@ -383,7 +431,7 @@ static int rgbkbd_enable(int enable)
return rv;
}
-static void rgbkbd_demo_set(enum rgbkbd_demo new_demo)
+static void rgbkbd_demo_set(enum ec_rgbkbd_demo new_demo)
{
CPRINTS("Setting demo %d with %d ms interval", demo, demo_interval_ms);
@@ -394,7 +442,7 @@ static void rgbkbd_demo_set(enum rgbkbd_demo new_demo)
rgbkbd_init();
rgbkbd_enable(1);
- if (demo == RGBKBD_DEMO_OFF)
+ if (demo == EC_RGBKBD_DEMO_OFF)
return;
demo_interval_ms = default_demo_interval_ms;
@@ -484,7 +532,7 @@ DECLARE_HOST_COMMAND(EC_CMD_RGBKBD_SET_COLOR, hc_rgbkbd_set_color,
static enum ec_status hc_rgbkbd(struct host_cmd_handler_args *args)
{
const struct ec_params_rgbkbd *p = args->params;
- enum ec_status rv = EC_RES_ERROR;
+ enum ec_status rv = EC_RES_SUCCESS;
if (rgbkbd_late_init())
return EC_RES_ERROR;
@@ -492,7 +540,15 @@ static enum ec_status hc_rgbkbd(struct host_cmd_handler_args *args)
switch (p->subcmd) {
case EC_RGBKBD_SUBCMD_CLEAR:
rgbkbd_reset_color(p->color);
- rv = EC_RES_SUCCESS;
+ break;
+ case EC_RGBKBD_SUBCMD_DEMO:
+ if (p->demo >= EC_RGBKBD_DEMO_COUNT)
+ return EC_RES_INVALID_PARAM;
+ rgbkbd_demo_set(p->demo);
+ break;
+ case EC_RGBKBD_SUBCMD_SET_SCALE:
+ if (rgbkbd_set_scale(p->set_scale.scale, p->set_scale.key))
+ rv = EC_RES_ERROR;
break;
default:
rv = EC_RES_INVALID_PARAM;
@@ -503,10 +559,26 @@ static enum ec_status hc_rgbkbd(struct host_cmd_handler_args *args)
}
DECLARE_HOST_COMMAND(EC_CMD_RGBKBD, hc_rgbkbd, EC_VER_MASK(0));
+static int int_to_rgb(const char *code, struct rgb_s *rgb)
+{
+ int val;
+ char *end;
+
+ val = strtoi(code, &end, 0);
+ if (*end || val > EC_RGBKBD_MAX_RGB_COLOR)
+ return EC_ERROR_INVAL;
+
+ rgb->r = (val >> 16) & 0xff;
+ rgb->g = (val >> 8) & 0xff;
+ rgb->b = (val >> 0) & 0xff;
+
+ return EC_SUCCESS;
+}
+
test_export_static int cc_rgb(int argc, char **argv)
{
char *end, *comma;
- struct rgb_s color;
+ struct rgb_s rgb, scale;
int gcc, x, y, val;
int i, rv = EC_SUCCESS;
@@ -525,39 +597,68 @@ test_export_static int cc_rgb(int argc, char **argv)
y = strtoi(comma + 1, &end, 0);
if (*end || y >= rgbkbd_vsize)
return EC_ERROR_PARAM1;
+
+ rv = int_to_rgb(argv[2], &rgb);
+ if (rv)
+ return EC_ERROR_PARAM2;
+
+ rgbkbd_demo_set(EC_RGBKBD_DEMO_OFF);
+
+ if (y < 0) {
+ /* Set all LEDs on column x. */
+ ccprintf("Set column %d to 0x%02x%02x%02x\n",
+ x, rgb.r, rgb.g, rgb.b);
+ for (i = 0; i < rgbkbd_vsize; i++)
+ rv = set_color_single(rgb, x, i);
+ } else if (x < 0) {
+ /* Set all LEDs on row y. */
+ ccprintf("Set row %d to 0x%02x%02x%02x\n",
+ y, rgb.r, rgb.g, rgb.b);
+ for (i = 0; i < rgbkbd_hsize; i++)
+ rv = set_color_single(rgb, i, y);
+ } else {
+ ccprintf("Set (%d,%d) to 0x%02x%02x%02x\n",
+ x, y, rgb.r, rgb.g, rgb.b);
+ rv = set_color_single(rgb, x, y);
+ }
} else if (!strcasecmp(argv[1], "all")) {
/* Usage 3 */
- x = -1;
- y = -1;
+ rv = int_to_rgb(argv[2], &rgb);
+ if (rv)
+ return EC_ERROR_PARAM2;
+
+ rgbkbd_demo_set(EC_RGBKBD_DEMO_OFF);
+ rgbkbd_reset_color(rgb);
} else if (!strcasecmp(argv[1], "demo")) {
/* Usage 4 */
val = strtoi(argv[2], &end, 0);
- if (*end || val >= RGBKBD_DEMO_COUNT)
+ if (*end || val >= EC_RGBKBD_DEMO_COUNT)
return EC_ERROR_PARAM1;
rgbkbd_demo_set(val);
- return EC_SUCCESS;
} else if (!strcasecmp(argv[1], "reset")) {
+ /* Usage 5: Reset */
rgbkbd_reset();
rv = rgbkbd_init();
if (rv)
return rv;
- return rgbkbd_enable(0);
+ rv = rgbkbd_enable(0);
} else if (!strcasecmp(argv[1], "enable")) {
- return rgbkbd_enable(1);
+ /* Usage 5: Enable */
+ rv = rgbkbd_enable(1);
} else if (!strcasecmp(argv[1], "disable")) {
- return rgbkbd_enable(0);
+ /* Usage 5: Disable */
+ rv = rgbkbd_enable(0);
} else if (!strcasecmp(argv[1], "scale")) {
/* Usage 6 */
- val = strtoi(argv[2], &end, 0);
- if (*end || val > RGBKBD_MAX_SCALE)
+ rv = int_to_rgb(argv[2], &scale);
+ if (rv)
return EC_ERROR_PARAM2;
- return rgbkbd_set_scale(val);
+ rv = rgbkbd_reset_scale(scale);
} else if (!strcasecmp(argv[1], "red")) {
- color.r = 255;
- color.g = 0;
- color.b = 0;
- rgbkbd_reset_color(color);
- return EC_SUCCESS;
+ rgb.r = 255;
+ rgb.g = 0;
+ rgb.b = 0;
+ rgbkbd_reset_color(rgb);
} else {
/* Usage 1 */
if (argc != 2)
@@ -565,46 +666,7 @@ test_export_static int cc_rgb(int argc, char **argv)
gcc = strtoi(argv[1], &end, 0);
if (*end || gcc < 0 || gcc > UINT8_MAX)
return EC_ERROR_PARAM1;
- return rgbkbd_set_global_brightness(gcc);
- }
-
- if (argc != 5)
- return EC_ERROR_PARAM_COUNT;
-
- val = strtoi(argv[2], &end, 0);
- if (*end || val < 0 || val > UINT8_MAX)
- return EC_ERROR_PARAM2;
- color.r = val;
- val = strtoi(argv[3], &end, 0);
- if (*end || val < 0 || val > UINT8_MAX)
- return EC_ERROR_PARAM3;
- color.g = val;
- val = strtoi(argv[4], &end, 0);
- if (*end || val < 0 || val > UINT8_MAX)
- return EC_ERROR_PARAM4;
- color.b = val;
-
- rgbkbd_demo_set(RGBKBD_DEMO_OFF);
- if (y < 0 && x < 0) {
- /* Usage 3 */
- rgbkbd_reset_color(color);
- } else if (y < 0) {
- /* Usage 2: Set all LEDs on column x. */
- ccprintf("Set column %d to 0x%02x%02x%02x\n",
- x, color.r, color.g, color.b);
- for (i = 0; i < rgbkbd_vsize; i++)
- rv = set_color_single(color, x, i);
- } else if (x < 0) {
- /* Usage 2: Set all LEDs on row y. */
- ccprintf("Set row %d to 0x%02x%02x%02x\n",
- y, color.r, color.g, color.b);
- for (i = 0; i < rgbkbd_hsize; i++)
- rv = set_color_single(color, i, y);
- } else {
- /* Usage 2 */
- ccprintf("Set (%d,%d) to 0x%02x%02x%02x\n",
- x, y, color.r, color.g, color.b);
- rv = set_color_single(color, x, y);
+ rv = rgbkbd_set_global_brightness(gcc);
}
return rv;
@@ -612,12 +674,12 @@ test_export_static int cc_rgb(int argc, char **argv)
#ifndef TEST_BUILD
DECLARE_CONSOLE_COMMAND(rgb, cc_rgb,
"\n"
- "1. rgbk <global-brightness>\n"
- "2. rgbk <col,row> <r-bright> <g-bright> <b-bright>\n"
- "3. rgbk all <r-bright> <g-bright> <b-bright>\n"
- "4. rgbk demo <id>\n"
- "5. rgbk reset/enable/disable/red\n"
- "6. rgbk scale <val>\n",
- "Set color of RGB keyboard"
+ "1. rgb <global-brightness>\n"
+ "2. rgb <col,row> <24-bit RGB code>\n"
+ "3. rgb all <24-bit RGB code>\n"
+ "4. rgb demo <id>\n"
+ "5. rgb reset/enable/disable/red\n"
+ "6. rgb scale <24-bit RGB scale>\n",
+ "Control RGB keyboard"
);
#endif
diff --git a/common/system.c b/common/system.c
index 9b0e6f25a0..013452c21a 100644
--- a/common/system.c
+++ b/common/system.c
@@ -12,7 +12,6 @@
#include "console.h"
#include "cpu.h"
#include "cros_board_info.h"
-#include "ec_version.h"
#include "dma.h"
#include "extpower.h"
#include "flash.h"
@@ -1056,13 +1055,12 @@ void system_enter_hibernate(uint32_t seconds, uint32_t microseconds)
* On ChromeOS devices, if AC is present, don't hibernate.
* It might trigger an immediate wake up (since AC is present),
* resulting in an AP reboot.
- * Hibernate when AC is present never occurs in normal circumstantces,
+ * Hibernate when AC is present never occurs in normal circumstances,
* this is to prevent an action triggered by developers.
* See: b/192259035
*/
- if (IS_ENABLED(CONFIG_EXTPOWER) &&
- (IS_ENABLED(HAS_TASK_CHIPSET) || IS_ENABLED(CONFIG_AP_PWRSEQ)) &&
- extpower_is_present()) {
+ if (IS_ENABLED(CONFIG_EXTPOWER) && IS_ENABLED(CONFIG_AP_POWER_CONTROL)
+ && extpower_is_present()) {
CPRINTS("AC on, skip hibernate");
return;
}
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index feda92c74e..1de01f9c48 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -1174,7 +1174,7 @@ __overridable int svdm_enter_dp_mode(int port, uint32_t mode_caps)
* could cause a wake up.) When in S5->S3 transition state, we
* should treat it as a SoC off state.
*/
-#if defined(HAS_TASK_CHIPSET) || defined(CONFIG_AP_PWRSEQ)
+#ifdef CONFIG_AP_POWER_CONTROL
if (!chipset_in_state(CHIPSET_STATE_ANY_SUSPEND | CHIPSET_STATE_ON))
return -1;
#endif
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 5dc133cb45..3f0408eedf 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2754,7 +2754,7 @@ static void pd_init_tasks(void)
if (initialized)
return;
-#if defined(HAS_TASK_CHIPSET) && defined(CONFIG_USB_PD_DUAL_ROLE)
+#if defined(CONFIG_AP_POWER_CONTROL) && defined(CONFIG_USB_PD_DUAL_ROLE)
/* Set dual-role state based on chipset power state */
if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
for (i = 0; i < board_get_usb_pd_port_count(); i++)
diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c
index 745454b647..159331171e 100644
--- a/common/usbc/usb_pd_dpm.c
+++ b/common/usbc/usb_pd_dpm.c
@@ -278,7 +278,7 @@ static void dpm_attempt_mode_entry(int port)
return;
}
-#if defined(HAS_TASK_CHIPSET) || defined(CONFIG_AP_PWRSEQ)
+#ifdef CONFIG_AP_POWER_CONTROL
/*
* Do not try to enter mode while CPU is off.
* CPU transitions (e.g b/158634281) can occur during the discovery
@@ -887,7 +887,7 @@ static uint8_t get_status_power_state_change(void)
{
enum pd_sdb_power_state ret = PD_SDB_POWER_STATE_NOT_SUPPORTED;
-#ifdef HAS_TASK_CHIPSET
+#ifdef CONFIG_AP_POWER_CONTROL
if (chipset_in_or_transitioning_to_state(CHIPSET_STATE_HARD_OFF)) {
ret = PD_SDB_POWER_STATE_G3;
} else if (chipset_in_or_transitioning_to_state(
@@ -906,7 +906,7 @@ static uint8_t get_status_power_state_change(void)
CHIPSET_STATE_STANDBY)) {
ret = PD_SDB_POWER_STATE_MODERN_STANDBY;
}
-#endif /* HAS_TASK_CHIPSET */
+#endif /* CONFIG_AP_POWER_CONTROL */
return ret | board_get_pd_sdb_power_indicator(ret);
}
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 046461b7a8..2da6b59f0a 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -547,7 +547,7 @@ int pd_get_rev(int port, enum tcpci_msg_type type)
#endif /* !CONFIG_USB_PR_SM */
-#if !defined(HAS_TASK_CHIPSET) && !defined(CONFIG_AP_PWRSEQ)
+#ifndef CONFIG_AP_POWER_CONTROL
__overridable enum pd_dual_role_states board_tc_get_initial_drp_mode(int port)
{
/*
@@ -1577,7 +1577,7 @@ void tc_state_init(int port)
*/
tc_policy_pd_enable(port, pd_comm_allowed_by_policy());
-#if defined(HAS_TASK_CHIPSET) || defined(CONFIG_AP_PWRSEQ)
+#ifdef CONFIG_AP_POWER_CONTROL
/* Set dual-role state based on chipset power state */
if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
pd_set_dual_role_and_event(port, PD_DRP_FORCE_SINK, 0);