diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-12-28 11:59:01 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-30 13:13:04 -0800 |
commit | d39bf704acbd254576e3fc880ec13e6cd09e88c7 (patch) | |
tree | 9fbe2f99d56229a5c4491553c148a90dfa01b814 /drivers/staging/greybus/control.c | |
parent | 57c6bcc635626e24fff3546bb072b4ba4163872b (diff) | |
download | op-kernel-dev-d39bf704acbd254576e3fc880ec13e6cd09e88c7.zip op-kernel-dev-d39bf704acbd254576e3fc880ec13e6cd09e88c7.tar.gz |
greybus: interface: Fetch and expose version of interface's firmware
The version of the currently running firmware on the module is useful
for userspace as it can be used to find if an update is available or
not. This patch fetches interface's version with a new control operation
and exposes the same in userspace.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/control.c')
-rw-r--r-- | drivers/staging/greybus/control.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c index 09ff797..4d65dbf 100644 --- a/drivers/staging/greybus/control.c +++ b/drivers/staging/greybus/control.c @@ -59,6 +59,35 @@ int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id) sizeof(request), NULL, 0); } +int gb_control_get_interface_version_operation(struct gb_interface *intf) +{ + struct gb_control_interface_version_response response; + struct gb_connection *connection = intf->control->connection; + int ret; + + /* The ES3 bootrom fails to boot if this request it sent to it */ + if (intf->boot_over_unipro) + return 0; + + ret = gb_operation_sync(connection, GB_CONTROL_TYPE_INTERFACE_VERSION, + NULL, 0, &response, sizeof(response)); + if (ret) { + dev_err(&connection->intf->dev, + "failed to get interface version: %d\n", ret); + /* + * FIXME: Return success until the time we bump version of + * control protocol. The interface-version is already set to + * 0.0, so no need to update that. + */ + return 0; + } + + intf->version_major = le16_to_cpu(response.major); + intf->version_minor = le16_to_cpu(response.minor); + + return 0; +} + struct gb_control *gb_control_create(struct gb_interface *intf) { struct gb_control *control; |