Commit | Line | Data |
---|---|---|
80ebe8a6 | 1 | /* |
a93db2d1 | 2 | * Greybus manifest definition |
80ebe8a6 | 3 | * |
cb705e0d | 4 | * See "Greybus Application Protocol" document (version 0.1) for |
908a85d7 | 5 | * details on these values and structures. |
80ebe8a6 | 6 | * |
4441f475 AE |
7 | * Copyright 2014-2015 Google Inc. |
8 | * Copyright 2014-2015 Linaro Ltd. | |
908a85d7 | 9 | * |
9b60aa02 | 10 | * Released under the GPLv2 and BSD licenses. |
80ebe8a6 GKH |
11 | */ |
12 | ||
1dd7f58f AE |
13 | #ifndef __GREYBUS_MANIFEST_H |
14 | #define __GREYBUS_MANIFEST_H | |
80ebe8a6 | 15 | |
80ebe8a6 | 16 | enum greybus_descriptor_type { |
72b0ffc0 | 17 | GREYBUS_TYPE_INVALID = 0x00, |
83a0cb59 | 18 | GREYBUS_TYPE_INTERFACE = 0x01, |
63cc932b | 19 | GREYBUS_TYPE_STRING = 0x02, |
83a0cb59 | 20 | GREYBUS_TYPE_BUNDLE = 0x03, |
63cc932b | 21 | GREYBUS_TYPE_CPORT = 0x04, |
80ebe8a6 GKH |
22 | }; |
23 | ||
63cc932b AE |
24 | enum greybus_protocol { |
25 | GREYBUS_PROTOCOL_CONTROL = 0x00, | |
9230e298 | 26 | /* 0x01 is unused */ |
63cc932b AE |
27 | GREYBUS_PROTOCOL_GPIO = 0x02, |
28 | GREYBUS_PROTOCOL_I2C = 0x03, | |
29 | GREYBUS_PROTOCOL_UART = 0x04, | |
30 | GREYBUS_PROTOCOL_HID = 0x05, | |
68190676 GKH |
31 | GREYBUS_PROTOCOL_USB = 0x06, |
32 | GREYBUS_PROTOCOL_SDIO = 0x07, | |
2724be03 | 33 | GREYBUS_PROTOCOL_POWER_SUPPLY = 0x08, |
34c6507c | 34 | GREYBUS_PROTOCOL_PWM = 0x09, |
357499df | 35 | /* 0x0a is unused */ |
68190676 GKH |
36 | GREYBUS_PROTOCOL_SPI = 0x0b, |
37 | GREYBUS_PROTOCOL_DISPLAY = 0x0c, | |
e61a2a71 | 38 | GREYBUS_PROTOCOL_CAMERA_MGMT = 0x0d, |
68190676 | 39 | GREYBUS_PROTOCOL_SENSOR = 0x0e, |
563e6b97 | 40 | GREYBUS_PROTOCOL_LIGHTS = 0x0f, |
68190676 | 41 | GREYBUS_PROTOCOL_VIBRATOR = 0x10, |
355a7058 | 42 | GREYBUS_PROTOCOL_LOOPBACK = 0x11, |
80ee8428 MG |
43 | GREYBUS_PROTOCOL_AUDIO_MGMT = 0x12, |
44 | GREYBUS_PROTOCOL_AUDIO_DATA = 0x13, | |
30c6d9d7 | 45 | GREYBUS_PROTOCOL_SVC = 0x14, |
5a53e02e | 46 | GREYBUS_PROTOCOL_BOOTROM = 0x15, |
e61a2a71 | 47 | GREYBUS_PROTOCOL_CAMERA_DATA = 0x16, |
9e04fb7b VK |
48 | GREYBUS_PROTOCOL_FW_DOWNLOAD = 0x17, |
49 | GREYBUS_PROTOCOL_FW_MANAGEMENT = 0x18, | |
e3eda54d | 50 | GREYBUS_PROTOCOL_AUTHENTICATION = 0x19, |
c0e65d02 | 51 | GREYBUS_PROTOCOL_LOG = 0x1a, |
63cc932b | 52 | /* ... */ |
e806c7fb | 53 | GREYBUS_PROTOCOL_RAW = 0xfe, |
63cc932b AE |
54 | GREYBUS_PROTOCOL_VENDOR = 0xff, |
55 | }; | |
56 | ||
57 | enum greybus_class_type { | |
063e6ec2 | 58 | GREYBUS_CLASS_CONTROL = 0x00, |
9230e298 | 59 | /* 0x01 is unused */ |
dc075408 VK |
60 | /* 0x02 is unused */ |
61 | /* 0x03 is unused */ | |
62 | /* 0x04 is unused */ | |
6ce3e03f | 63 | GREYBUS_CLASS_HID = 0x05, |
dc075408 VK |
64 | /* 0x06 is unused */ |
65 | /* 0x07 is unused */ | |
2724be03 | 66 | GREYBUS_CLASS_POWER_SUPPLY = 0x08, |
dc075408 | 67 | /* 0x09 is unused */ |
d6fefbe1 | 68 | GREYBUS_CLASS_BRIDGED_PHY = 0x0a, |
dc075408 | 69 | /* 0x0b is unused */ |
6ce3e03f GKH |
70 | GREYBUS_CLASS_DISPLAY = 0x0c, |
71 | GREYBUS_CLASS_CAMERA = 0x0d, | |
72 | GREYBUS_CLASS_SENSOR = 0x0e, | |
dccbe40f VK |
73 | GREYBUS_CLASS_LIGHTS = 0x0f, |
74 | GREYBUS_CLASS_VIBRATOR = 0x10, | |
75 | GREYBUS_CLASS_LOOPBACK = 0x11, | |
3b710ec0 VK |
76 | GREYBUS_CLASS_AUDIO = 0x12, |
77 | /* 0x13 is unused */ | |
a23aa564 | 78 | /* 0x14 is unused */ |
5a53e02e | 79 | GREYBUS_CLASS_BOOTROM = 0x15, |
9e04fb7b | 80 | GREYBUS_CLASS_FW_MANAGEMENT = 0x16, |
c0e65d02 | 81 | GREYBUS_CLASS_LOG = 0x17, |
948b3bd5 VK |
82 | /* ... */ |
83 | GREYBUS_CLASS_RAW = 0xfe, | |
063e6ec2 | 84 | GREYBUS_CLASS_VENDOR = 0xff, |
80ebe8a6 GKH |
85 | }; |
86 | ||
8c81d460 BD |
87 | enum { |
88 | GREYBUS_INTERFACE_FEATURE_TIMESYNC = BIT(0), | |
89 | }; | |
90 | ||
63cc932b AE |
91 | /* |
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. | |
95 | */ | |
96 | struct greybus_descriptor_string { | |
97 | __u8 length; | |
98 | __u8 id; | |
99 | __u8 string[0]; | |
af6e8b42 | 100 | } __packed; |
d5877800 | 101 | |
ecf7d579 | 102 | /* |
a93db2d1 VK |
103 | * An interface descriptor describes information about an interface as a whole, |
104 | * *not* the functions within it. | |
ecf7d579 AE |
105 | */ |
106 | struct greybus_descriptor_interface { | |
a93db2d1 VK |
107 | __u8 vendor_stringid; |
108 | __u8 product_stringid; | |
8c81d460 BD |
109 | __u8 features; |
110 | __u8 pad; | |
af6e8b42 | 111 | } __packed; |
ecf7d579 | 112 | |
83a0cb59 | 113 | /* |
88e6d37c | 114 | * An bundle descriptor defines an identification number and a class for |
83a0cb59 VK |
115 | * each bundle. |
116 | * | |
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. | |
120 | * | |
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. | |
125 | * | |
88e6d37c | 126 | * @class: It is used by kernel to know the functionality provided by the |
83a0cb59 VK |
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'. | |
130 | * | |
131 | */ | |
132 | struct greybus_descriptor_bundle { | |
133 | __u8 id; /* interface-relative id (0..) */ | |
88e6d37c | 134 | __u8 class; |
499ee955 | 135 | __u8 pad[2]; |
af6e8b42 | 136 | } __packed; |
83a0cb59 | 137 | |
63cc932b | 138 | /* |
1db0a5ff | 139 | * A CPort descriptor indicates the id of the bundle within the |
63cc932b | 140 | * module it's associated with, along with the CPort id used to |
7fba0079 | 141 | * address the CPort. The protocol id defines the format of messages |
63cc932b AE |
142 | * exchanged using the CPort. |
143 | */ | |
ecf7d579 AE |
144 | struct greybus_descriptor_cport { |
145 | __le16 id; | |
f03eec87 | 146 | __u8 bundle; |
7fba0079 | 147 | __u8 protocol_id; /* enum greybus_protocol */ |
af6e8b42 | 148 | } __packed; |
ecf7d579 | 149 | |
ecf7d579 AE |
150 | struct greybus_descriptor_header { |
151 | __le16 size; | |
63cc932b | 152 | __u8 type; /* enum greybus_descriptor_type */ |
499ee955 | 153 | __u8 pad; |
af6e8b42 | 154 | } __packed; |
d5877800 | 155 | |
6dca7b97 | 156 | struct greybus_descriptor { |
63cc932b | 157 | struct greybus_descriptor_header header; |
80ebe8a6 | 158 | union { |
80ebe8a6 | 159 | struct greybus_descriptor_string string; |
ecf7d579 | 160 | struct greybus_descriptor_interface interface; |
83a0cb59 | 161 | struct greybus_descriptor_bundle bundle; |
80ebe8a6 | 162 | struct greybus_descriptor_cport cport; |
80ebe8a6 | 163 | }; |
af6e8b42 | 164 | } __packed; |
80ebe8a6 | 165 | |
ecf7d579 AE |
166 | struct greybus_manifest_header { |
167 | __le16 size; | |
168 | __u8 version_major; | |
169 | __u8 version_minor; | |
af6e8b42 | 170 | } __packed; |
ecf7d579 | 171 | |
badad68e AE |
172 | struct greybus_manifest { |
173 | struct greybus_manifest_header header; | |
174 | struct greybus_descriptor descriptors[0]; | |
af6e8b42 | 175 | } __packed; |
48123e0e | 176 | |
1dd7f58f | 177 | #endif /* __GREYBUS_MANIFEST_H */ |