ec/google: Add command to set APU SKU ID to EC

EC needs to have command to set SKU ID from APU to support
specific feature (ex: keyboard backlight) for variant board.

BUG=b:65359225
BRANCH=reef
TEST=emerge-snappy coreboot
Change-Id: I8cd3b8f646d4134d6bfff2869f6df2d9c615c157
Signed-off-by: Kevin Chiu <Kevin.Chiu@quantatw.com>
Reviewed-on: https://review.coreboot.org/21504
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Kevin Chiu 2017-09-12 09:13:41 +08:00 committed by Aaron Durbin
parent 461797e3ed
commit e2bb059187
3 changed files with 27 additions and 2 deletions

View File

@ -263,6 +263,27 @@ int google_chromeec_check_feature(int feature)
return r.flags[feature / 32] & EC_FEATURE_MASK_0(feature);
}
int google_chromeec_set_sku_id(u32 skuid)
{
struct chromeec_command cmd;
struct ec_sku_id_info set_skuid = {
.sku_id = skuid
};
cmd.cmd_code = EC_CMD_SET_SKU_ID;
cmd.cmd_version = 0;
cmd.cmd_size_in = sizeof(set_skuid);
cmd.cmd_data_in = &set_skuid;
cmd.cmd_data_out = NULL;
cmd.cmd_size_out = 0;
cmd.cmd_dev_index = 0;
if (google_chromeec_command(&cmd) != 0)
return -1;
return 0;
}
#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_RTC)
int rtc_get(struct rtc_time *time)
{
@ -389,7 +410,7 @@ u16 google_chromeec_get_board_version(void)
u32 google_chromeec_get_sku_id(void)
{
struct chromeec_command cmd;
struct ec_response_sku_id sku_v;
struct ec_sku_id_info sku_v;
cmd.cmd_code = EC_CMD_GET_SKU_ID;
cmd.cmd_version = 0;

View File

@ -50,6 +50,7 @@ int google_chromeec_check_feature(int feature);
uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size);
u16 google_chromeec_get_board_version(void);
u32 google_chromeec_get_sku_id(void);
int google_chromeec_set_sku_id(u32 skuid);
u32 google_chromeec_get_events_b(void);
int google_chromeec_clear_events_b(u32 mask);
int google_chromeec_kbbacklight(int percent);

View File

@ -1124,7 +1124,10 @@ struct __ec_align4 ec_response_get_features {
/* Get the board's SKU ID from EC */
#define EC_CMD_GET_SKU_ID 0x000E
struct __ec_align4 ec_response_sku_id {
/* Set SKU ID from AP */
#define EC_CMD_SET_SKU_ID 0x000F
struct __ec_align4 ec_sku_id_info {
uint32_t sku_id;
};