diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2022-05-18 11:27:16 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-20 00:09:45 +0000 |
commit | d621541e408b0f0e7425812976545c375f00f498 (patch) | |
tree | 6e3075bc69b0d987c7477766ca4f81c95ce66ae9 /common/rgb_keyboard.c | |
parent | 297cf3d897beca27fc072f6521fd9c597e69baef (diff) | |
download | chrome-ec-d621541e408b0f0e7425812976545c375f00f498.tar.gz |
RGBKBD: Set GCC, scale, color in rgbkbd_init
This patch makes rgbkbd_init set GCC, scale, and color. The default
values are provided as rgbkbd_default.
BUG=b:233099161
BRANCH=None
TEST=Vell
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: Idf9c0bb7af014d5b81d1c02dfe34af55dd219477
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3654488
Reviewed-by: Parth Malkan <parthmalkan@google.com>
Diffstat (limited to 'common/rgb_keyboard.c')
-rw-r--r-- | common/rgb_keyboard.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/common/rgb_keyboard.c b/common/rgb_keyboard.c index 80d2ea04aa..fe0c44ce07 100644 --- a/common/rgb_keyboard.c +++ b/common/rgb_keyboard.c @@ -38,6 +38,12 @@ uint8_t rgbkbd_table[EC_RGBKBD_MAX_KEY_COUNT]; static enum rgbkbd_state rgbkbd_state; +const struct rgbkbd_init rgbkbd_default = { + .gcc = RGBKBD_MAX_GCC_LEVEL / 2, + .scale = RGBKBD_MAX_SCALE, + .color = { .r = 0xff, .g = 0xff, .b = 0xff }, /* white */ +}; + static int set_color_single(struct rgb_s color, int x, int y) { struct rgbkbd *ctx = &rgbkbds[0]; @@ -286,6 +292,8 @@ 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; e = ctx->cfg->drv->init(ctx); if (e) { @@ -294,12 +302,24 @@ static int rgbkbd_init(void) continue; } - e = ctx->cfg->drv->set_scale(ctx, 0, 0x80, get_grid_size(ctx)); + e = ctx->cfg->drv->set_scale(ctx, 0, scale, get_grid_size(ctx)); if (e) { - CPRINTS("Failed to set scale of GRID%d (%d)", i, 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)", + gcc, i, e); + rv = e; + continue; + } + + rgbkbd_reset_color(ctx->init->color); + CPRINTS("Initialized GRID%d", i); } |