Kevin Chiu has uploaded this change for review. ( https://review.coreboot.org/21400
Change subject: google/snappy: Update EC keyboard backlight flag by SKU ID ......................................................................
google/snappy: Update EC keyboard backlight flag by SKU ID
Set SKU ID by ec command EC_CMD_SET_SKU_ID to update EC keyboard backlight flag.
BUG=none BRANCH=reef TEST=emerge-snappy coreboot Change-Id: I1153aa0b89250c55f311dd93a01fcef47afd7292 Signed-off-by: Kevin Chiu Kevin.Chiu@quantatw.com --- M src/ec/google/chromeec/ec.c M src/ec/google/chromeec/ec.h M src/ec/google/chromeec/ec_commands.h M src/mainboard/google/reef/mainboard.c 4 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/21400/1
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 4d47982..c382849 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -263,6 +263,29 @@ return r.flags[feature / 32] & EC_FEATURE_MASK_0(feature); }
+int google_chromeec_set_sku_id(int skuid) +{ + struct chromeec_command cmd; + struct ec_params_set_sku_id set_skuid = { + .sku_id = skuid + }; + + printk(BIOS_DEBUG, "DBG: google_chromeec_set_sku_id: %d\n", skuid); + + cmd.cmd_code = EC_CMD_GET_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) { diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 60d5a32..59dae89 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -47,6 +47,7 @@ void google_chromeec_check_pd_image(int expected_type);
int google_chromeec_check_feature(int feature); +int google_chromeec_set_sku_id(int skuid); 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); diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h index 46ab905..6ce5db5 100644 --- a/src/ec/google/chromeec/ec_commands.h +++ b/src/ec/google/chromeec/ec_commands.h @@ -1129,6 +1129,13 @@ };
/*****************************************************************************/ +/* set sku id */ +#define EC_CMD_GET_SKU_ID 0x0F +struct ec_params_set_sku_id { + uint32_t sku_id; +} __packed; + +/*****************************************************************************/ /* Flash commands */
/* Get flash info */ diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c index c6b1997..a2d3f81 100644 --- a/src/mainboard/google/reef/mainboard.c +++ b/src/mainboard/google/reef/mainboard.c @@ -28,6 +28,9 @@ #include <vendorcode/google/chromeos/chromeos.h> #include <variant/ec.h> #include <variant/gpio.h> +#include <ec/google/chromeec/ec.h> + +static int board_sku(void);
static void mainboard_init(void *chip_info) { @@ -38,6 +41,8 @@ boardid = board_id(); printk(BIOS_INFO, "Board ID: %d\n", boardid);
+ google_chromeec_set_sku_id(board_sku()); + pads = variant_gpio_table(&num); gpio_configure_pads(pads, num);