greybus: Add bundle descriptor type
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 1 Apr 2015 15:01:59 +0000 (20:31 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Sun, 5 Apr 2015 16:12:04 +0000 (18:12 +0200)
A bundle corresponds to a device and a greybus driver binds to it. This patch
adds a type and descriptor for bundle.

This also shuffles the values of 'enum greybus_descriptor_type' to align
them with Greybus Specifications.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_manifest.h
drivers/staging/greybus/manifest.c

index 9ab1c82..96702f4 100644 (file)
 
 enum greybus_descriptor_type {
        GREYBUS_TYPE_INVALID            = 0x00,
-       GREYBUS_TYPE_MODULE             = 0x01,
+       GREYBUS_TYPE_INTERFACE          = 0x01,
        GREYBUS_TYPE_STRING             = 0x02,
-       GREYBUS_TYPE_INTERFACE          = 0x03,
+       GREYBUS_TYPE_BUNDLE             = 0x03,
        GREYBUS_TYPE_CPORT              = 0x04,
        GREYBUS_TYPE_CLASS              = 0x05,
+       GREYBUS_TYPE_MODULE             = 0x06,
 };
 
 enum greybus_protocol {
@@ -108,6 +109,30 @@ struct greybus_descriptor_interface {
        __u8    id;     /* module-relative id (0..) */
 };
 
+/*
+ * An bundle descriptor defines an identification number and a class type for
+ * each bundle.
+ *
+ * @id: Uniquely identifies a bundle within a interface, its sole purpose is to
+ * allow CPort descriptors to specify which bundle they are associated with.
+ * The first bundle will have id 0, second will have 1 and so on.
+ *
+ * The largest CPort id associated with an bundle (defined by a
+ * CPort descriptor in the manifest) is used to determine how to
+ * encode the device id and module number in UniPro packets
+ * that use the bundle.
+ *
+ * @class_type: It is used by kernel to know the functionality provided by the
+ * bundle and will be matched against drivers functinality while probing greybus
+ * driver. It should contain one of the values defined in
+ * 'enum greybus_class_type'.
+ *
+ */
+struct greybus_descriptor_bundle {
+       __u8    id;     /* interface-relative id (0..) */
+       __u8    class_type;
+};
+
 /*
  * A CPort descriptor indicates the id of the bundle within the
  * module it's associated with, along with the CPort id used to
@@ -139,6 +164,7 @@ struct greybus_descriptor {
                struct greybus_descriptor_module        module;
                struct greybus_descriptor_string        string;
                struct greybus_descriptor_interface     interface;
+               struct greybus_descriptor_bundle        bundle;
                struct greybus_descriptor_cport         cport;
                struct greybus_descriptor_class         class;
        };
index c29a0c8..c00e378 100644 (file)
@@ -26,6 +26,8 @@ static const char *get_descriptor_type_string(u8 type)
                return "interface";
        case GREYBUS_TYPE_CPORT:
                return "cport";
+       case GREYBUS_TYPE_BUNDLE:
+               return "bundle";
        case GREYBUS_TYPE_CLASS:
                return "class";
        default: