diff options
-rw-r--r-- | common/rgb_keyboard.c | 8 | ||||
-rw-r--r-- | include/ec_commands.h | 18 | ||||
-rw-r--r-- | include/rgb_keyboard.h | 6 | ||||
-rw-r--r-- | test/rgb_keyboard.c | 2 |
4 files changed, 34 insertions, 0 deletions
diff --git a/common/rgb_keyboard.c b/common/rgb_keyboard.c index 815e4a3435..fab8f9bb83 100644 --- a/common/rgb_keyboard.c +++ b/common/rgb_keyboard.c @@ -532,8 +532,12 @@ 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; + struct ec_response_rgbkbd *r = args->response; enum ec_status rv = EC_RES_SUCCESS; + /* Default value is 0 */ + args->response_size = 0; + if (rgbkbd_late_init()) return EC_RES_ERROR; @@ -550,6 +554,10 @@ static enum ec_status hc_rgbkbd(struct host_cmd_handler_args *args) if (rgbkbd_set_scale(p->set_scale.scale, p->set_scale.key)) rv = EC_RES_ERROR; break; + case EC_RGBKBD_SUBCMD_GET_CONFIG: + args->response_size = sizeof(*r); + r->rgbkbd_type = rgbkbd_type; + break; default: rv = EC_RES_INVALID_PARAM; break; diff --git a/include/ec_commands.h b/include/ec_commands.h index d86063ba27..ade6eff070 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -7159,6 +7159,7 @@ enum ec_rgbkbd_subcmd { EC_RGBKBD_SUBCMD_CLEAR = 1, EC_RGBKBD_SUBCMD_DEMO = 2, EC_RGBKBD_SUBCMD_SET_SCALE = 3, + EC_RGBKBD_SUBCMD_GET_CONFIG = 4, EC_RGBKBD_SUBCMD_COUNT }; @@ -7171,6 +7172,15 @@ enum ec_rgbkbd_demo { BUILD_ASSERT(EC_RGBKBD_DEMO_COUNT <= 255); +enum ec_rgbkbd_type { + EC_RGBKBD_TYPE_UNKNOWN = 0, + EC_RGBKBD_TYPE_PER_KEY = 1, /* e.g. Vell */ + EC_RGBKBD_TYPE_FOUR_ZONES_40_LEDS = 2, /* e.g. Taniks */ + EC_RGBKBD_TYPE_FOUR_ZONES_12_LEDS = 3, /* e.g. Osiris */ + EC_RGBKBD_TYPE_FOUR_ZONES_15_LEDS = 4, /* e.g. Mithrax */ + EC_RGBKBD_TYPE_COUNT, +}; + struct ec_rgbkbd_set_scale { uint8_t key; struct rgb_s scale; @@ -7185,6 +7195,14 @@ struct ec_params_rgbkbd { }; } __ec_align1; +struct ec_response_rgbkbd { + /* + * RGBKBD type supported by the device. + */ + + uint8_t rgbkbd_type; /* enum ec_rgbkbd_type */ +} __ec_align1; + struct ec_params_rgbkbd_set_color { /* Specifies the starting key ID whose color is being changed. */ uint8_t start_key; diff --git a/include/rgb_keyboard.h b/include/rgb_keyboard.h index e795389225..4f948542d9 100644 --- a/include/rgb_keyboard.h +++ b/include/rgb_keyboard.h @@ -154,6 +154,12 @@ extern const uint8_t rgbkbd_hsize; extern const uint8_t rgbkbd_vsize; /* + * rgbkbd_type describes the rgb kb type supported. + * i.e. Number of zones and number of LEDs + */ +extern const enum ec_rgbkbd_type rgbkbd_type; + +/* * rgbkbd_map describes a mapping from key IDs to LED IDs. * * Multiple keys can be mapped to one LED and one key can be mapped to multiple diff --git a/test/rgb_keyboard.c b/test/rgb_keyboard.c index a8da437f7c..804f7f12e9 100644 --- a/test/rgb_keyboard.c +++ b/test/rgb_keyboard.c @@ -51,6 +51,8 @@ const uint8_t rgbkbd_count = ARRAY_SIZE(rgbkbds); const uint8_t rgbkbd_hsize = RGB_GRID0_COL + RGB_GRID1_COL; const uint8_t rgbkbd_vsize = RGB_GRID0_ROW; +const enum ec_rgbkbd_type rgbkbd_type = EC_RGBKBD_TYPE_UNKNOWN; + const uint8_t rgbkbd_map[] = { RGBKBD_DELM, RGBKBD_COORD(1, 2), RGBKBD_DELM, |