Skip to content

Commit

Permalink
platform/chrome: cros_ec_proto: Add version for ec_command
Browse files Browse the repository at this point in the history
Add a version parameter to cros_ec_command() for callers that may want
to specify which version of the host command they would like to use.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210930022403.3358070-5-pmalani@chromium.org
  • Loading branch information
Prashant Malani authored and Enric Balletbo i Serra committed Sep 30, 2021
1 parent 5d12225 commit 4f14063
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions drivers/platform/chrome/cros_ec_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count);
* cros_ec_command - Send a command to the EC.
*
* @ec_dev: EC device
* @version: EC command version
* @command: EC command
* @outdata: EC command output data
* @outsize: Size of outdata
Expand All @@ -924,6 +925,7 @@ EXPORT_SYMBOL_GPL(cros_ec_get_sensor_count);
* Return: >= 0 on success, negative error number on failure.
*/
int cros_ec_command(struct cros_ec_device *ec_dev,
unsigned int version,
int command,
void *outdata,
int outsize,
Expand All @@ -937,6 +939,7 @@ int cros_ec_command(struct cros_ec_device *ec_dev,
if (!msg)
return -ENOMEM;

msg->version = version;
msg->command = command;
msg->outsize = outsize;
msg->insize = insize;
Expand Down
2 changes: 1 addition & 1 deletion drivers/platform/chrome/cros_usbpd_notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void cros_usbpd_get_event_and_notify(struct device *dev,
}

/* Check for PD host events on EC. */
ret = cros_ec_command(ec_dev, EC_CMD_PD_HOST_EVENT_STATUS,
ret = cros_ec_command(ec_dev, 0, EC_CMD_PD_HOST_EVENT_STATUS,
NULL, 0, &host_event_status, sizeof(host_event_status));
if (ret < 0) {
dev_warn(dev, "Can't get host event status (err: %d)\n", ret);
Expand Down
4 changes: 2 additions & 2 deletions include/linux/platform_data/cros_ec_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ bool cros_ec_check_features(struct cros_ec_dev *ec, int feature);

int cros_ec_get_sensor_count(struct cros_ec_dev *ec);

int cros_ec_command(struct cros_ec_device *ec_dev, int command, void *outdata, int outsize,
void *indata, int insize);
int cros_ec_command(struct cros_ec_device *ec_dev, unsigned int version, int command, void *outdata,
int outsize, void *indata, int insize);

/**
* cros_ec_get_time_ns() - Return time in ns.
Expand Down

0 comments on commit 4f14063

Please sign in to comment.