浏览代码

greybus: Add bundle descriptor type

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>
Viresh Kumar 10 年之前
父节点
当前提交
83a0cb593b
共有 2 个文件被更改,包括 30 次插入2 次删除
  1. 28 2
      drivers/staging/greybus/greybus_manifest.h
  2. 2 0
      drivers/staging/greybus/manifest.c

+ 28 - 2
drivers/staging/greybus/greybus_manifest.h

@@ -17,11 +17,12 @@
 
 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;
 	};

+ 2 - 0
drivers/staging/greybus/manifest.c

@@ -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: