Commit 6f8a028f authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

greybus: gpbridge: Expose protocol_id in sysfs

Right now, userspace doesn't have any way to find what protocol does a
gpbridge device implement. And this is essential for the scripts to
know, to expect what kind of device will be present inside the gpbN
directory.

Expose 'protocol_id' in sysfs to fix that.

Tested by checking that the field appears with GP module on EVT 1.5.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarSandeep Patil <sspatil@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 792db396
......@@ -26,6 +26,22 @@ struct gpbridge_host {
static DEFINE_IDA(gpbridge_id);
static ssize_t protocol_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev);
return sprintf(buf, "0x%02x\n", gpbdev->cport_desc->protocol_id);
}
static DEVICE_ATTR_RO(protocol_id);
static struct attribute *gpbdev_attrs[] = {
&dev_attr_protocol_id.attr,
NULL,
};
ATTRIBUTE_GROUPS(gpbdev);
static void gpbdev_release(struct device *dev)
{
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev);
......@@ -190,7 +206,7 @@ static struct gpbridge_device *gb_gpbridge_create_dev(struct gb_bundle *bundle,
gpbdev->dev.parent = &bundle->dev;
gpbdev->dev.bus = &gpbridge_bus_type;
gpbdev->dev.release = gpbdev_release;
gpbdev->dev.groups = NULL;
gpbdev->dev.groups = gpbdev_groups;
gpbdev->dev.dma_mask = bundle->dev.dma_mask;
dev_set_name(&gpbdev->dev, "gpb%d", id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment