diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-04-01 10:05:57 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-07 22:25:25 +0000 |
commit | 17487510e3e2f91f44692e7d30db8c7d8fcde2bd (patch) | |
tree | caa942810c3558d127123d50a7f2fd9bbf469417 /common | |
parent | 6d80aeed939a35859c87517236e88c847604499d (diff) | |
download | chrome-ec-17487510e3e2f91f44692e7d30db8c7d8fcde2bd.tar.gz |
ec: Add Inventory command
Add command that list supported features by the firmware.
Also let the firmware indicates if more features are expected in the RW
version.
This will help the cros_ec framework load the right driver(s) for
exposing information via sysfs.
BUG=chromium:428364
BRANCH=none
TEST=Test on samus on both ec and pd:
localhost ~ # ectool inventory
EC supported features:
1 : Flash support
2 : Direct Fan power management support
3 : Keyboard backlight support
4 : Lightbar support
6 : Motion Sensors support
7 : Keyboard support
9 : BIOS Port 80h access support
10 : Thermal management support
11 : Switch backlight on/off support
12 : Switch wifi on/off support
13 : Host event support
14 : GPIO support
15 : I2C master support
16 : Charger support
17 : Simple Battery support
18 : Smart Battery support
21 : Control downstream MCU support
localhost ~ # ectool --name cros_pd inventory
EC supported features:
1 : Flash support
14 : GPIO support
15 : I2C master support
22 : USB Cros Power Delievery support
Change-Id: Ib6eaac91fda86835e754c5316ecf81fbc27786e5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/263463
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/host_command.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/common/host_command.c b/common/host_command.c index 0a6226b59e..451bff74f3 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -678,6 +678,98 @@ DECLARE_HOST_COMMAND(EC_CMD_TEST_PROTOCOL, host_command_test_protocol, EC_VER_MASK(0)); +/* Returns supported features. */ +static int host_command_get_features(struct host_cmd_handler_args *args) +{ + struct ec_response_get_features *r = args->response; + args->response_size = sizeof(*r); + + memset(r, 0, sizeof(*r)); + r->flags[0] = 0 +#ifdef CONFIG_FW_LIMITED_IMAGE + | EC_FEATURE_MASK_0(EC_FEATURE_LIMITED) +#endif +#ifdef CONFIG_FLASH + | EC_FEATURE_MASK_0(EC_FEATURE_FLASH) +#endif +#ifdef CONFIG_FANS + | EC_FEATURE_MASK_0(EC_FEATURE_PWM_FAN) +#endif +#ifdef CONFIG_PWM_KBLIGHT + | EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB) +#endif +#ifdef HAS_TASK_LIGHTBAR + | EC_FEATURE_MASK_0(EC_FEATURE_LIGHTBAR) +#endif +#ifdef CONFIG_LED_COMMON + | EC_FEATURE_MASK_0(EC_FEATURE_LED) +#endif +#ifdef HAS_TASK_MOTIONSENSE + | EC_FEATURE_MASK_0(EC_FEATURE_MOTION_SENSE) +#endif +#ifdef HAS_TASK_KEYSCAN + | EC_FEATURE_MASK_0(EC_FEATURE_KEYB) +#endif +#ifdef CONFIG_PSTORE + | EC_FEATURE_MASK_0(EC_FEATURE_PSTORE) +#endif +#ifdef CONFIG_LPC + | EC_FEATURE_MASK_0(EC_FEATURE_PORT80) +#endif +#ifdef CONFIG_TEMP_SENSOR + | EC_FEATURE_MASK_0(EC_FEATURE_THERMAL) +#endif +/* Hack to uniquely identify Samus and Falco ec */ +#if (defined CONFIG_BACKLIGHT_LID) || \ + (defined CONFIG_BATTERY_SAMUS) || \ + (defined CONFIG_EXTPOWER_FALCO) + | EC_FEATURE_MASK_0(EC_FEATURE_BKLIGHT_SWITCH) +#endif +#ifdef CONFIG_WIRELESS + | EC_FEATURE_MASK_0(EC_FEATURE_WIFI_SWITCH) +#endif +#ifdef CONFIG_HOSTCMD_EVENTS + | EC_FEATURE_MASK_0(EC_FEATURE_HOST_EVENTS) +#endif +#ifdef CONFIG_COMMON_GPIO + | EC_FEATURE_MASK_0(EC_FEATURE_GPIO) +#endif +#ifdef CONFIG_I2C + | EC_FEATURE_MASK_0(EC_FEATURE_I2C) +#endif +#ifdef CONFIG_CHARGER + | EC_FEATURE_MASK_0(EC_FEATURE_CHARGER) +#endif +#if (defined CONFIG_BATTERY) || (defined CONFIG_BATTERY_SMART) + | EC_FEATURE_MASK_0(EC_FEATURE_BATTERY) +#endif +#ifdef CONFIG_BATTERY_SMART + | EC_FEATURE_MASK_0(EC_FEATURE_SMART_BATTERY) +#endif +#ifdef CONFIG_AP_HANG_DETECT + | EC_FEATURE_MASK_0(EC_FEATURE_HANG_DETECT) +#endif +#ifdef CONFIG_PMU_POWERINFO + | EC_FEATURE_MASK_0(EC_FEATURE_PMU) +#endif +#ifdef HAS_TASK_PDCMD + | EC_FEATURE_MASK_0(EC_FEATURE_SUB_MCU) +#endif +#ifdef CONFIG_CHARGE_MANAGER + | EC_FEATURE_MASK_0(EC_FEATURE_USB_PD) +#endif +/* should be more generic */ +#ifdef CONFIG_USB_SWITCH_TSU6721 + | EC_FEATURE_MASK_0(EC_FEATURE_USB_MUX) +#endif + ; + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_GET_FEATURES, + host_command_get_features, + EC_VER_MASK(0)); + + /*****************************************************************************/ /* Console commands */ |