mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
Merge branches 'ib-mfd-legacy-gpio-7.3' and 'ib-mfd-platform-chrome-7.3' into ibs-for-mfd-merged
This commit is contained in:
commit
f1f3afd19f
|
|
@ -198,6 +198,17 @@ static int ec_device_probe(struct platform_device *pdev)
|
|||
ec->features.flags[1] = -1U; /* Not cached yet */
|
||||
device_initialize(&ec->class_dev);
|
||||
|
||||
/*
|
||||
* Add the class device
|
||||
*/
|
||||
ec->class_dev.class = &cros_class;
|
||||
ec->class_dev.parent = dev;
|
||||
ec->class_dev.release = cros_ec_class_release;
|
||||
|
||||
retval = cros_ec_read_features(ec);
|
||||
if (retval < 0)
|
||||
goto failed;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cros_mcu_devices); i++) {
|
||||
/*
|
||||
* Check whether this is actually a dedicated MCU rather
|
||||
|
|
@ -215,13 +226,6 @@ static int ec_device_probe(struct platform_device *pdev)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the class device
|
||||
*/
|
||||
ec->class_dev.class = &cros_class;
|
||||
ec->class_dev.parent = dev;
|
||||
ec->class_dev.release = cros_ec_class_release;
|
||||
|
||||
retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name);
|
||||
if (retval) {
|
||||
dev_err(dev, "dev_set_name failed => %d\n", retval);
|
||||
|
|
|
|||
|
|
@ -946,6 +946,27 @@ u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev)
|
|||
}
|
||||
EXPORT_SYMBOL(cros_ec_get_host_event);
|
||||
|
||||
/**
|
||||
* cros_ec_read_features() - Read EC features
|
||||
*
|
||||
* @ec: EC device.
|
||||
*
|
||||
* Return: >= 0 on success, negative error number on failure.
|
||||
*/
|
||||
int cros_ec_read_features(struct cros_ec_dev *ec)
|
||||
{
|
||||
int ret = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_GET_FEATURES + ec->cmd_offset,
|
||||
NULL, 0, &ec->features, sizeof(ec->features));
|
||||
|
||||
if (ret < 0) {
|
||||
dev_warn(ec->dev, "cannot get EC features: %d\n", ret);
|
||||
memset(&ec->features, 0, sizeof(ec->features));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cros_ec_read_features);
|
||||
|
||||
/**
|
||||
* cros_ec_check_features() - Test for the presence of EC features
|
||||
*
|
||||
|
|
@ -960,17 +981,10 @@ EXPORT_SYMBOL(cros_ec_get_host_event);
|
|||
bool cros_ec_check_features(struct cros_ec_dev *ec, int feature)
|
||||
{
|
||||
struct ec_response_get_features *features = &ec->features;
|
||||
int ret;
|
||||
|
||||
if (features->flags[0] == -1U && features->flags[1] == -1U) {
|
||||
/* features bitmap not read yet */
|
||||
ret = cros_ec_cmd(ec->ec_dev, 0, EC_CMD_GET_FEATURES + ec->cmd_offset,
|
||||
NULL, 0, features, sizeof(*features));
|
||||
if (ret < 0) {
|
||||
dev_warn(ec->dev, "cannot get EC features: %d\n", ret);
|
||||
memset(features, 0, sizeof(*features));
|
||||
}
|
||||
|
||||
cros_ec_read_features(ec);
|
||||
dev_dbg(ec->dev, "EC features %08x %08x\n",
|
||||
features->flags[0], features->flags[1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,6 +271,8 @@ int cros_ec_get_next_event(struct cros_ec_device *ec_dev,
|
|||
|
||||
u32 cros_ec_get_host_event(struct cros_ec_device *ec_dev);
|
||||
|
||||
int cros_ec_read_features(struct cros_ec_dev *ec);
|
||||
|
||||
bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);
|
||||
|
||||
int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user