greybus: interface: Receive serial-number on hotplug event
authorViresh Kumar <viresh.kumar@linaro.org>
Mon, 28 Dec 2015 06:29:00 +0000 (11:59 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 30 Dec 2015 21:13:04 +0000 (13:13 -0800)
Two exactly same modules can be uniquely identified using module's
serial-number. This patch updates the interface hotplug event to also
receive the serial-number of the module.

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>
drivers/staging/greybus/Documentation/sysfs-bus-greybus
drivers/staging/greybus/Documentation/sysfs/greybus1/1-2/serial_number [new file with mode: 0644]
drivers/staging/greybus/Documentation/sysfs/greybus1/1-4/serial_number [new file with mode: 0644]
drivers/staging/greybus/Documentation/sysfs/greybus2/2-3/serial_number [new file with mode: 0644]
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h
drivers/staging/greybus/svc.c

index 2cd17c70694052407c42d0fac849779133a5323d..0d16d7649a5a58fe7624b7eb0d4f5c6c6c66b349 100644 (file)
@@ -37,6 +37,14 @@ Contact:     Greg Kroah-Hartman <greg@kroah.com>
 Description:
                The ID of a Greybus interface.
 
+What:          /sys/bus/greybus/device/N-I/serial_number
+Date:          October 2015
+KernelVersion: 4.XX
+Contact:       Greg Kroah-Hartman <greg@kroah.com>
+Description:
+               Serial Number of the Greybus interface, represented by a 64 bit
+               hexadecimal number.
+
 What:          /sys/bus/greybus/device/N-I/product_id
 Date:          October 2015
 KernelVersion: 4.XX
diff --git a/drivers/staging/greybus/Documentation/sysfs/greybus1/1-2/serial_number b/drivers/staging/greybus/Documentation/sysfs/greybus1/1-2/serial_number
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/drivers/staging/greybus/Documentation/sysfs/greybus1/1-4/serial_number b/drivers/staging/greybus/Documentation/sysfs/greybus1/1-4/serial_number
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/drivers/staging/greybus/Documentation/sysfs/greybus2/2-3/serial_number b/drivers/staging/greybus/Documentation/sysfs/greybus2/2-3/serial_number
new file mode 100644 (file)
index 0000000..e69de29
index 773e1ab789c02bba11e7f4db47b19d59b0b0453f..f66f4d784f279d63e94907a01e3f76c7921c3116 100644 (file)
@@ -757,6 +757,7 @@ struct gb_svc_intf_hotplug_request {
                __le32  ddbl1_prod_id;
                __le32  ara_vend_id;
                __le32  ara_prod_id;
+               __le64  serial_number;
        } data;
 } __packed;
 /* hotplug response has no payload */
index c4b9e14868289951d412cad089c03164e5a3aa34..69eb7886ceae12d8aa4f7fbf565dd282bad3b4c9 100644 (file)
@@ -27,6 +27,7 @@ gb_interface_attr(vendor_id, "0x%08x");
 gb_interface_attr(product_id, "0x%08x");
 gb_interface_attr(vendor_string, "%s");
 gb_interface_attr(product_string, "%s");
+gb_interface_attr(serial_number, "0x%016llx");
 
 static struct attribute *interface_attrs[] = {
        &dev_attr_ddbl1_manufacturer_id.attr,
@@ -36,6 +37,7 @@ static struct attribute *interface_attrs[] = {
        &dev_attr_product_id.attr,
        &dev_attr_vendor_string.attr,
        &dev_attr_product_string.attr,
+       &dev_attr_serial_number.attr,
        NULL,
 };
 ATTRIBUTE_GROUPS(interface);
index d192b74ab5e1d042188c186aa2af1e524de7a2fc..a1a1f9f5c2cb915024ffce0eef8dab49797d1f2c 100644 (file)
@@ -30,6 +30,7 @@ struct gb_interface {
        u32 ddbl1_product_id;
        u32 vendor_id;
        u32 product_id;
+       u64 serial_number;
 
        struct gb_host_device *hd;
 
index 417869942d1115479cee3d5ed4a73b23fb29cb9b..fe7bd2850d5d8081b8791fab9f1645b052b058d0 100644 (file)
@@ -429,6 +429,7 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
        intf->ddbl1_product_id = le32_to_cpu(request->data.ddbl1_prod_id);
        intf->vendor_id = le32_to_cpu(request->data.ara_vend_id);
        intf->product_id = le32_to_cpu(request->data.ara_prod_id);
+       intf->serial_number = le64_to_cpu(request->data.serial_number);
 
        ret = gb_svc_read_and_clear_module_boot_status(intf);
        if (ret) {