2 * Greybus manifest definition
4 * See "Greybus Application Protocol" document (version 0.1) for
5 * details on these values and structures.
7 * Copyright 2014-2015 Google Inc.
8 * Copyright 2014-2015 Linaro Ltd.
10 * Released under the GPLv2 and BSD licenses.
13 #ifndef __GREYBUS_MANIFEST_H
14 #define __GREYBUS_MANIFEST_H
16 enum greybus_descriptor_type {
17 GREYBUS_TYPE_INVALID = 0x00,
18 GREYBUS_TYPE_INTERFACE = 0x01,
19 GREYBUS_TYPE_STRING = 0x02,
20 GREYBUS_TYPE_BUNDLE = 0x03,
21 GREYBUS_TYPE_CPORT = 0x04,
24 enum greybus_protocol {
25 GREYBUS_PROTOCOL_CONTROL = 0x00,
27 GREYBUS_PROTOCOL_GPIO = 0x02,
28 GREYBUS_PROTOCOL_I2C = 0x03,
29 GREYBUS_PROTOCOL_UART = 0x04,
30 GREYBUS_PROTOCOL_HID = 0x05,
31 GREYBUS_PROTOCOL_USB = 0x06,
32 GREYBUS_PROTOCOL_SDIO = 0x07,
33 GREYBUS_PROTOCOL_POWER_SUPPLY = 0x08,
34 GREYBUS_PROTOCOL_PWM = 0x09,
36 GREYBUS_PROTOCOL_SPI = 0x0b,
37 GREYBUS_PROTOCOL_DISPLAY = 0x0c,
38 GREYBUS_PROTOCOL_CAMERA_MGMT = 0x0d,
39 GREYBUS_PROTOCOL_SENSOR = 0x0e,
40 GREYBUS_PROTOCOL_LIGHTS = 0x0f,
41 GREYBUS_PROTOCOL_VIBRATOR = 0x10,
42 GREYBUS_PROTOCOL_LOOPBACK = 0x11,
43 GREYBUS_PROTOCOL_AUDIO_MGMT = 0x12,
44 GREYBUS_PROTOCOL_AUDIO_DATA = 0x13,
45 GREYBUS_PROTOCOL_SVC = 0x14,
46 GREYBUS_PROTOCOL_BOOTROM = 0x15,
47 GREYBUS_PROTOCOL_CAMERA_DATA = 0x16,
48 GREYBUS_PROTOCOL_FW_DOWNLOAD = 0x17,
49 GREYBUS_PROTOCOL_FW_MANAGEMENT = 0x18,
50 GREYBUS_PROTOCOL_AUTHENTICATION = 0x19,
51 GREYBUS_PROTOCOL_LOG = 0x1a,
53 GREYBUS_PROTOCOL_RAW = 0xfe,
54 GREYBUS_PROTOCOL_VENDOR = 0xff,
57 enum greybus_class_type {
58 GREYBUS_CLASS_CONTROL = 0x00,
63 GREYBUS_CLASS_HID = 0x05,
66 GREYBUS_CLASS_POWER_SUPPLY = 0x08,
68 GREYBUS_CLASS_BRIDGED_PHY = 0x0a,
70 GREYBUS_CLASS_DISPLAY = 0x0c,
71 GREYBUS_CLASS_CAMERA = 0x0d,
72 GREYBUS_CLASS_SENSOR = 0x0e,
73 GREYBUS_CLASS_LIGHTS = 0x0f,
74 GREYBUS_CLASS_VIBRATOR = 0x10,
75 GREYBUS_CLASS_LOOPBACK = 0x11,
76 GREYBUS_CLASS_AUDIO = 0x12,
79 GREYBUS_CLASS_BOOTROM = 0x15,
80 GREYBUS_CLASS_FW_MANAGEMENT = 0x16,
81 GREYBUS_CLASS_LOG = 0x17,
83 GREYBUS_CLASS_RAW = 0xfe,
84 GREYBUS_CLASS_VENDOR = 0xff,
88 GREYBUS_INTERFACE_FEATURE_TIMESYNC = BIT(0),
92 * The string in a string descriptor is not NUL-terminated. The
93 * size of the descriptor will be rounded up to a multiple of 4
94 * bytes, by padding the string with 0x00 bytes if necessary.
96 struct greybus_descriptor_string {
103 * An interface descriptor describes information about an interface as a whole,
104 * *not* the functions within it.
106 struct greybus_descriptor_interface {
107 __u8 vendor_stringid;
108 __u8 product_stringid;
114 * An bundle descriptor defines an identification number and a class for
117 * @id: Uniquely identifies a bundle within a interface, its sole purpose is to
118 * allow CPort descriptors to specify which bundle they are associated with.
119 * The first bundle will have id 0, second will have 1 and so on.
121 * The largest CPort id associated with an bundle (defined by a
122 * CPort descriptor in the manifest) is used to determine how to
123 * encode the device id and module number in UniPro packets
124 * that use the bundle.
126 * @class: It is used by kernel to know the functionality provided by the
127 * bundle and will be matched against drivers functinality while probing greybus
128 * driver. It should contain one of the values defined in
129 * 'enum greybus_class_type'.
132 struct greybus_descriptor_bundle {
133 __u8 id; /* interface-relative id (0..) */
139 * A CPort descriptor indicates the id of the bundle within the
140 * module it's associated with, along with the CPort id used to
141 * address the CPort. The protocol id defines the format of messages
142 * exchanged using the CPort.
144 struct greybus_descriptor_cport {
147 __u8 protocol_id; /* enum greybus_protocol */
150 struct greybus_descriptor_header {
152 __u8 type; /* enum greybus_descriptor_type */
156 struct greybus_descriptor {
157 struct greybus_descriptor_header header;
159 struct greybus_descriptor_string string;
160 struct greybus_descriptor_interface interface;
161 struct greybus_descriptor_bundle bundle;
162 struct greybus_descriptor_cport cport;
166 struct greybus_manifest_header {
172 struct greybus_manifest {
173 struct greybus_manifest_header header;
174 struct greybus_descriptor descriptors[0];
177 #endif /* __GREYBUS_MANIFEST_H */