cros_ec: Support reading EC features
The EC can support a variety of features and provides a way to find out what is available. Add support for this. Also update the feature list to the lastest available while we are here. This is at: https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/include/ec_commands.h Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -516,4 +516,25 @@ int cros_ec_set_lid_shutdown_mask(struct udevice *dev, int enable);
|
||||
* @return 0 if OK, -ve on error
|
||||
*/
|
||||
int cros_ec_hello(struct udevice *dev, uint *handshakep);
|
||||
|
||||
/**
|
||||
* cros_ec_get_features() - Get the set of features provided by the EC
|
||||
*
|
||||
* See enum ec_feature_code for the list of available features
|
||||
*
|
||||
* @dev: CROS-EC device
|
||||
* @featuresp: Returns a bitmask of supported features
|
||||
* @return 0 if OK, -ve on error
|
||||
*/
|
||||
int cros_ec_get_features(struct udevice *dev, u64 *featuresp);
|
||||
|
||||
/**
|
||||
* cros_ec_check_feature() - Check if a feature is supported
|
||||
*
|
||||
* @dev: CROS-EC device
|
||||
* @feature: Feature number to check (enum ec_feature_code)
|
||||
* @return true if supported, false if not, -ve on error
|
||||
*/
|
||||
int cros_ec_check_feature(struct udevice *dev, uint feature);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1101,13 +1101,50 @@ enum ec_feature_code {
|
||||
EC_FEATURE_DEVICE_EVENT = 31,
|
||||
/* EC supports the unified wake masks for LPC/eSPI systems */
|
||||
EC_FEATURE_UNIFIED_WAKE_MASKS = 32,
|
||||
/* EC supports 64-bit host events */
|
||||
EC_FEATURE_HOST_EVENT64 = 33,
|
||||
/* EC runs code in RAM (not in place, a.k.a. XIP) */
|
||||
EC_FEATURE_EXEC_IN_RAM = 34,
|
||||
/* EC supports CEC commands */
|
||||
EC_FEATURE_CEC = 35,
|
||||
/* EC supports tight sensor timestamping. */
|
||||
EC_FEATURE_MOTION_SENSE_TIGHT_TIMESTAMPS = 36,
|
||||
/*
|
||||
* EC supports tablet mode detection aligned to Chrome and allows
|
||||
* setting of threshold by host command using
|
||||
* MOTIONSENSE_CMD_TABLET_MODE_LID_ANGLE.
|
||||
*/
|
||||
EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS = 37,
|
||||
/*
|
||||
* Early Firmware Selection ver.2. Enabled by CONFIG_VBOOT_EFS2.
|
||||
* Note this is a RO feature. So, a query (EC_CMD_GET_FEATURES) should
|
||||
* be sent to RO to be precise.
|
||||
*/
|
||||
EC_FEATURE_EFS2 = 38,
|
||||
/* The MCU is a System Companion Processor (SCP). */
|
||||
EC_FEATURE_SCP = 39,
|
||||
/* The MCU is an Integrated Sensor Hub */
|
||||
EC_FEATURE_ISH = 40,
|
||||
/* New TCPMv2 TYPEC_ prefaced commands supported */
|
||||
EC_FEATURE_TYPEC_CMD = 41,
|
||||
/*
|
||||
* The EC will wait for direction from the AP to enter Type-C alternate
|
||||
* modes or USB4.
|
||||
*/
|
||||
EC_FEATURE_TYPEC_REQUIRE_AP_MODE_ENTRY = 42,
|
||||
/*
|
||||
* The EC will wait for an acknowledge from the AP after setting the
|
||||
* mux.
|
||||
*/
|
||||
EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK = 43,
|
||||
};
|
||||
|
||||
#define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32))
|
||||
#define EC_FEATURE_MASK_1(event_code) (1UL << (event_code - 32))
|
||||
struct __ec_align4 ec_response_get_features {
|
||||
#define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
|
||||
#define EC_FEATURE_MASK_1(event_code) BIT(event_code - 32)
|
||||
|
||||
struct ec_response_get_features {
|
||||
uint32_t flags[2];
|
||||
};
|
||||
} __ec_align4;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Get the board's SKU ID from EC */
|
||||
|
||||
Reference in New Issue
Block a user