]>
Commit | Line | Data |
---|---|---|
453bbea8 JS |
1 | /* |
2 | * This file is provided under a dual BSD/GPLv2 license. When using or | |
3 | * redistributing this file, you may do so under either license. | |
4 | * | |
5 | * GPL LICENSE SUMMARY | |
6 | * | |
7 | * Copyright(c) 2014 - 2015 Google Inc. All rights reserved. | |
8 | * Copyright(c) 2014 - 2015 Linaro Ltd. All rights reserved. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of version 2 of the GNU General Public License as | |
12 | * published by the Free Software Foundation. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * General Public License version 2 for more details. | |
18 | * | |
19 | * BSD LICENSE | |
20 | * | |
21 | * Copyright(c) 2014 - 2015 Google Inc. All rights reserved. | |
22 | * Copyright(c) 2014 - 2015 Linaro Ltd. All rights reserved. | |
23 | * | |
24 | * Redistribution and use in source and binary forms, with or without | |
25 | * modification, are permitted provided that the following conditions | |
26 | * are met: | |
27 | * | |
28 | * * Redistributions of source code must retain the above copyright | |
29 | * notice, this list of conditions and the following disclaimer. | |
30 | * * Redistributions in binary form must reproduce the above copyright | |
31 | * notice, this list of conditions and the following disclaimer in | |
32 | * the documentation and/or other materials provided with the | |
33 | * distribution. | |
34 | * * Neither the name of Google Inc. or Linaro Ltd. nor the names of | |
35 | * its contributors may be used to endorse or promote products | |
36 | * derived from this software without specific prior written | |
37 | * permission. | |
38 | * | |
39 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
40 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
41 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
42 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR | |
43 | * LINARO LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
44 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
45 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
46 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
47 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
48 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
49 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
50 | */ | |
51 | ||
012d7d4f AE |
52 | #ifndef __GREYBUS_PROTOCOLS_H |
53 | #define __GREYBUS_PROTOCOLS_H | |
453bbea8 | 54 | |
c8dd60db VK |
55 | /* Fixed IDs for control/svc protocols */ |
56 | ||
57 | /* Device ID of SVC and AP */ | |
58 | #define GB_DEVICE_ID_SVC 0 | |
59 | #define GB_DEVICE_ID_AP 1 | |
60 | #define GB_DEVICE_ID_MODULES_START 2 | |
cdee4f75 | 61 | |
ec320625 VK |
62 | /* |
63 | * Bundle/cport for control/svc cport: The same bundle/cport is shared by both | |
64 | * CONTROL and SVC protocols for communication between AP and SVC. | |
65 | */ | |
66 | #define GB_SVC_BUNDLE_ID 0 | |
ef5d949a | 67 | #define GB_SVC_CPORT_ID 0 |
cdee4f75 | 68 | #define GB_CONTROL_BUNDLE_ID 0 |
ef5d949a | 69 | #define GB_CONTROL_CPORT_ID 0 |
cdee4f75 | 70 | |
6366d73f | 71 | |
e34fae58 VK |
72 | /* |
73 | * All operation messages (both requests and responses) begin with | |
74 | * a header that encodes the size of the message (header included). | |
75 | * This header also contains a unique identifier, that associates a | |
76 | * response message with its operation. The header contains an | |
77 | * operation type field, whose interpretation is dependent on what | |
78 | * type of protocol is used over the connection. The high bit | |
79 | * (0x80) of the operation type field is used to indicate whether | |
80 | * the message is a request (clear) or a response (set). | |
81 | * | |
82 | * Response messages include an additional result byte, which | |
83 | * communicates the result of the corresponding request. A zero | |
84 | * result value means the operation completed successfully. Any | |
85 | * other value indicates an error; in this case, the payload of the | |
86 | * response message (if any) is ignored. The result byte must be | |
87 | * zero in the header for a request message. | |
88 | * | |
89 | * The wire format for all numeric fields in the header is little | |
90 | * endian. Any operation-specific data begins immediately after the | |
91 | * header. | |
92 | */ | |
93 | struct gb_operation_msg_hdr { | |
94 | __le16 size; /* Size in bytes of header + payload */ | |
95 | __le16 operation_id; /* Operation unique id */ | |
96 | __u8 type; /* E.g GB_I2C_TYPE_* or GB_GPIO_TYPE_* */ | |
97 | __u8 result; /* Result of request (in responses only) */ | |
98 | __u8 pad[2]; /* must be zero (ignore when read) */ | |
b701686a | 99 | } __packed; |
e34fae58 | 100 | |
ec320625 | 101 | |
2b11a45d VK |
102 | /* Generic request numbers supported by all modules */ |
103 | #define GB_REQUEST_TYPE_INVALID 0x00 | |
104 | #define GB_REQUEST_TYPE_PROTOCOL_VERSION 0x01 | |
105 | ||
cfb16906 JH |
106 | struct gb_protocol_version_request { |
107 | __u8 major; | |
108 | __u8 minor; | |
109 | } __packed; | |
ec320625 | 110 | |
6366d73f VK |
111 | struct gb_protocol_version_response { |
112 | __u8 major; | |
113 | __u8 minor; | |
b701686a | 114 | } __packed; |
6366d73f VK |
115 | |
116 | /* Control Protocol */ | |
117 | ||
cdee4f75 | 118 | /* Greybus control request types */ |
e217ae76 | 119 | #define GB_CONTROL_TYPE_VERSION 0x01 |
cdee4f75 VK |
120 | #define GB_CONTROL_TYPE_PROBE_AP 0x02 |
121 | #define GB_CONTROL_TYPE_GET_MANIFEST_SIZE 0x03 | |
122 | #define GB_CONTROL_TYPE_GET_MANIFEST 0x04 | |
123 | #define GB_CONTROL_TYPE_CONNECTED 0x05 | |
124 | #define GB_CONTROL_TYPE_DISCONNECTED 0x06 | |
d39bf704 | 125 | #define GB_CONTROL_TYPE_INTERFACE_VERSION 0x0a |
b807aa7a | 126 | #define GB_CONTROL_TYPE_BUNDLE_VERSION 0x0b |
cdee4f75 | 127 | |
e217ae76 JH |
128 | struct gb_control_version_request { |
129 | __u8 major; | |
130 | __u8 minor; | |
131 | } __packed; | |
132 | ||
133 | struct gb_control_version_response { | |
134 | __u8 major; | |
135 | __u8 minor; | |
136 | } __packed; | |
137 | ||
b807aa7a JH |
138 | struct gb_control_bundle_version_request { |
139 | __u8 bundle_id; | |
140 | } __packed; | |
141 | ||
142 | struct gb_control_bundle_version_response { | |
143 | __u8 major; | |
144 | __u8 minor; | |
145 | } __packed; | |
146 | ||
cdee4f75 VK |
147 | /* Control protocol manifest get size request has no payload*/ |
148 | struct gb_control_get_manifest_size_response { | |
149 | __le16 size; | |
b701686a | 150 | } __packed; |
cdee4f75 VK |
151 | |
152 | /* Control protocol manifest get request has no payload */ | |
153 | struct gb_control_get_manifest_response { | |
154 | __u8 data[0]; | |
b701686a | 155 | } __packed; |
cdee4f75 VK |
156 | |
157 | /* Control protocol [dis]connected request */ | |
158 | struct gb_control_connected_request { | |
159 | __le16 cport_id; | |
b701686a | 160 | } __packed; |
cdee4f75 VK |
161 | |
162 | struct gb_control_disconnected_request { | |
163 | __le16 cport_id; | |
b701686a | 164 | } __packed; |
cdee4f75 VK |
165 | /* Control protocol [dis]connected response has no payload */ |
166 | ||
d39bf704 VK |
167 | /* Control protocol interface version request has no payload */ |
168 | struct gb_control_interface_version_response { | |
169 | __le16 major; | |
170 | __le16 minor; | |
171 | } __packed; | |
172 | ||
90f1b617 | 173 | |
e5273381 GKH |
174 | /* APBridge protocol */ |
175 | ||
176 | /* request APB1 log */ | |
177 | #define GB_APB_REQUEST_LOG 0x02 | |
178 | ||
179 | /* request to map a cport to bulk in and bulk out endpoints */ | |
180 | #define GB_APB_REQUEST_EP_MAPPING 0x03 | |
181 | ||
182 | /* request to get the number of cports available */ | |
183 | #define GB_APB_REQUEST_CPORT_COUNT 0x04 | |
184 | ||
185 | /* request to reset a cport state */ | |
186 | #define GB_APB_REQUEST_RESET_CPORT 0x05 | |
187 | ||
188 | /* request to time the latency of messages on a given cport */ | |
189 | #define GB_APB_REQUEST_LATENCY_TAG_EN 0x06 | |
190 | #define GB_APB_REQUEST_LATENCY_TAG_DIS 0x07 | |
191 | ||
192 | /* request to control the CSI transmitter */ | |
193 | #define GB_APB_REQUEST_CSI_TX_CONTROL 0x08 | |
194 | ||
4dbf5056 MG |
195 | /* request to control the CSI transmitter */ |
196 | #define GB_APB_REQUEST_AUDIO_CONTROL 0x09 | |
197 | ||
e5273381 | 198 | |
90f1b617 VK |
199 | /* Firmware Protocol */ |
200 | ||
201 | /* Version of the Greybus firmware protocol we support */ | |
202 | #define GB_FIRMWARE_VERSION_MAJOR 0x00 | |
203 | #define GB_FIRMWARE_VERSION_MINOR 0x01 | |
204 | ||
205 | /* Greybus firmware request types */ | |
8ec589b9 | 206 | #define GB_FIRMWARE_TYPE_VERSION 0x01 |
90f1b617 VK |
207 | #define GB_FIRMWARE_TYPE_FIRMWARE_SIZE 0x02 |
208 | #define GB_FIRMWARE_TYPE_GET_FIRMWARE 0x03 | |
209 | #define GB_FIRMWARE_TYPE_READY_TO_BOOT 0x04 | |
4c9e2284 | 210 | #define GB_FIRMWARE_TYPE_AP_READY 0x05 /* Request with no-payload */ |
f1e941a6 | 211 | #define GB_FIRMWARE_TYPE_GET_VID_PID 0x06 /* Request with no-payload */ |
90f1b617 | 212 | |
3563ff88 ES |
213 | /* FIXME: remove all ES2-specific identifiers from the kernel */ |
214 | #define ES2_DDBL1_MFR_ID 0x00000126 | |
215 | #define ES2_DDBL1_PROD_ID 0x00001000 | |
216 | ||
90f1b617 VK |
217 | /* Greybus firmware boot stages */ |
218 | #define GB_FIRMWARE_BOOT_STAGE_ONE 0x01 /* Reserved for the boot ROM */ | |
219 | #define GB_FIRMWARE_BOOT_STAGE_TWO 0x02 /* Firmware package to be loaded by the boot ROM */ | |
220 | #define GB_FIRMWARE_BOOT_STAGE_THREE 0x03 /* Module personality package loaded by Stage 2 firmware */ | |
221 | ||
222 | /* Greybus firmware ready to boot status */ | |
223 | #define GB_FIRMWARE_BOOT_STATUS_INVALID 0x00 /* Firmware blob could not be validated */ | |
224 | #define GB_FIRMWARE_BOOT_STATUS_INSECURE 0x01 /* Firmware blob is valid but insecure */ | |
225 | #define GB_FIRMWARE_BOOT_STATUS_SECURE 0x02 /* Firmware blob is valid and secure */ | |
226 | ||
227 | /* Max firmware data fetch size in bytes */ | |
228 | #define GB_FIRMWARE_FETCH_MAX 2000 | |
229 | ||
8ec589b9 JH |
230 | struct gb_firmware_version_request { |
231 | __u8 major; | |
232 | __u8 minor; | |
233 | } __packed; | |
234 | ||
235 | struct gb_firmware_version_response { | |
236 | __u8 major; | |
237 | __u8 minor; | |
238 | } __packed; | |
239 | ||
90f1b617 VK |
240 | /* Firmware protocol firmware size request/response */ |
241 | struct gb_firmware_size_request { | |
242 | __u8 stage; | |
829a91e7 | 243 | } __packed; |
90f1b617 VK |
244 | |
245 | struct gb_firmware_size_response { | |
246 | __le32 size; | |
829a91e7 | 247 | } __packed; |
90f1b617 VK |
248 | |
249 | /* Firmware protocol get firmware request/response */ | |
250 | struct gb_firmware_get_firmware_request { | |
251 | __le32 offset; | |
252 | __le32 size; | |
829a91e7 | 253 | } __packed; |
90f1b617 VK |
254 | |
255 | struct gb_firmware_get_firmware_response { | |
256 | __u8 data[0]; | |
829a91e7 | 257 | } __packed; |
90f1b617 VK |
258 | |
259 | /* Firmware protocol Ready to boot request */ | |
260 | struct gb_firmware_ready_to_boot_request { | |
90f1b617 | 261 | __u8 status; |
829a91e7 | 262 | } __packed; |
90f1b617 VK |
263 | /* Firmware protocol Ready to boot response has no payload */ |
264 | ||
f1e941a6 VK |
265 | /* Firmware protocol get VID/PID request has no payload */ |
266 | struct gb_firmware_get_vid_pid_response { | |
267 | __le32 vendor_id; | |
268 | __le32 product_id; | |
269 | } __packed; | |
270 | ||
90f1b617 | 271 | |
2724be03 RMS |
272 | /* Power Supply */ |
273 | ||
274 | /* Version of the Greybus power supply protocol we support */ | |
275 | #define GB_POWER_SUPPLY_VERSION_MAJOR 0x00 | |
276 | #define GB_POWER_SUPPLY_VERSION_MINOR 0x01 | |
277 | ||
278 | /* Greybus power supply request types */ | |
ffe2e248 RMS |
279 | #define GB_POWER_SUPPLY_TYPE_GET_SUPPLIES 0x02 |
280 | #define GB_POWER_SUPPLY_TYPE_GET_DESCRIPTION 0x03 | |
281 | #define GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS 0x04 | |
282 | #define GB_POWER_SUPPLY_TYPE_GET_PROPERTY 0x05 | |
283 | #define GB_POWER_SUPPLY_TYPE_SET_PROPERTY 0x06 | |
284 | #define GB_POWER_SUPPLY_TYPE_EVENT 0x07 | |
285 | ||
286 | /* Should match up with battery technologies in linux/power_supply.h */ | |
2724be03 RMS |
287 | #define GB_POWER_SUPPLY_TECH_UNKNOWN 0x0000 |
288 | #define GB_POWER_SUPPLY_TECH_NiMH 0x0001 | |
289 | #define GB_POWER_SUPPLY_TECH_LION 0x0002 | |
290 | #define GB_POWER_SUPPLY_TECH_LIPO 0x0003 | |
291 | #define GB_POWER_SUPPLY_TECH_LiFe 0x0004 | |
292 | #define GB_POWER_SUPPLY_TECH_NiCd 0x0005 | |
293 | #define GB_POWER_SUPPLY_TECH_LiMn 0x0006 | |
294 | ||
ffe2e248 RMS |
295 | /* Should match up with power supply types in linux/power_supply.h */ |
296 | #define GB_POWER_SUPPLY_UNKNOWN_TYPE 0x0000 | |
297 | #define GB_POWER_SUPPLY_BATTERY_TYPE 0x0001 | |
298 | #define GB_POWER_SUPPLY_UPS_TYPE 0x0002 | |
299 | #define GB_POWER_SUPPLY_MAINS_TYPE 0x0003 | |
300 | #define GB_POWER_SUPPLY_USB_TYPE 0x0004 | |
301 | #define GB_POWER_SUPPLY_USB_DCP_TYPE 0x0005 | |
302 | #define GB_POWER_SUPPLY_USB_CDP_TYPE 0x0006 | |
303 | #define GB_POWER_SUPPLY_USB_ACA_TYPE 0x0007 | |
304 | ||
305 | /* Should match up with power supply health in linux/power_supply.h */ | |
306 | #define GB_POWER_SUPPLY_HEALTH_UNKNOWN 0x0000 | |
307 | #define GB_POWER_SUPPLY_HEALTH_GOOD 0x0001 | |
308 | #define GB_POWER_SUPPLY_HEALTH_OVERHEAT 0x0002 | |
309 | #define GB_POWER_SUPPLY_HEALTH_DEAD 0x0003 | |
310 | #define GB_POWER_SUPPLY_HEALTH_OVERVOLTAGE 0x0004 | |
311 | #define GB_POWER_SUPPLY_HEALTH_UNSPEC_FAILURE 0x0005 | |
312 | #define GB_POWER_SUPPLY_HEALTH_COLD 0x0006 | |
313 | #define GB_POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE 0x0007 | |
314 | #define GB_POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE 0x0008 | |
315 | ||
316 | /* Should match up with battery status in linux/power_supply.h */ | |
317 | #define GB_POWER_SUPPLY_STATUS_UNKNOWN 0x0000 | |
318 | #define GB_POWER_SUPPLY_STATUS_CHARGING 0x0001 | |
319 | #define GB_POWER_SUPPLY_STATUS_DISCHARGING 0x0002 | |
320 | #define GB_POWER_SUPPLY_STATUS_NOT_CHARGING 0x0003 | |
321 | #define GB_POWER_SUPPLY_STATUS_FULL 0x0004 | |
322 | ||
323 | struct gb_power_supply_get_supplies_response { | |
324 | __u8 supplies_count; | |
b701686a | 325 | } __packed; |
ce832943 | 326 | |
ffe2e248 RMS |
327 | struct gb_power_supply_get_description_request { |
328 | __u8 psy_id; | |
329 | } __packed; | |
330 | ||
331 | struct gb_power_supply_get_description_response { | |
332 | __u8 manufacturer[32]; | |
333 | __u8 model[32]; | |
334 | __u8 serial_number[32]; | |
335 | __le16 type; | |
336 | __u8 properties_count; | |
337 | } __packed; | |
ce832943 | 338 | |
ffe2e248 RMS |
339 | struct gb_power_supply_props_desc { |
340 | __u8 property; | |
341 | #define GB_POWER_SUPPLY_PROP_STATUS 0x00 | |
342 | #define GB_POWER_SUPPLY_PROP_CHARGE_TYPE 0x01 | |
343 | #define GB_POWER_SUPPLY_PROP_HEALTH 0x02 | |
344 | #define GB_POWER_SUPPLY_PROP_PRESENT 0x03 | |
345 | #define GB_POWER_SUPPLY_PROP_ONLINE 0x04 | |
346 | #define GB_POWER_SUPPLY_PROP_AUTHENTIC 0x05 | |
347 | #define GB_POWER_SUPPLY_PROP_TECHNOLOGY 0x06 | |
348 | #define GB_POWER_SUPPLY_PROP_CYCLE_COUNT 0x07 | |
349 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX 0x08 | |
350 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN 0x09 | |
351 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN 0x0A | |
352 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN 0x0B | |
353 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_NOW 0x0C | |
354 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_AVG 0x0D | |
355 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_OCV 0x0E | |
356 | #define GB_POWER_SUPPLY_PROP_VOLTAGE_BOOT 0x0F | |
357 | #define GB_POWER_SUPPLY_PROP_CURRENT_MAX 0x10 | |
358 | #define GB_POWER_SUPPLY_PROP_CURRENT_NOW 0x11 | |
359 | #define GB_POWER_SUPPLY_PROP_CURRENT_AVG 0x12 | |
360 | #define GB_POWER_SUPPLY_PROP_CURRENT_BOOT 0x13 | |
361 | #define GB_POWER_SUPPLY_PROP_POWER_NOW 0x14 | |
362 | #define GB_POWER_SUPPLY_PROP_POWER_AVG 0x15 | |
363 | #define GB_POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN 0x16 | |
364 | #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN 0x17 | |
365 | #define GB_POWER_SUPPLY_PROP_CHARGE_FULL 0x18 | |
366 | #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY 0x19 | |
367 | #define GB_POWER_SUPPLY_PROP_CHARGE_NOW 0x1A | |
368 | #define GB_POWER_SUPPLY_PROP_CHARGE_AVG 0x1B | |
369 | #define GB_POWER_SUPPLY_PROP_CHARGE_COUNTER 0x1C | |
370 | #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT 0x1D | |
371 | #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX 0x1E | |
372 | #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE 0x1F | |
373 | #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX 0x20 | |
374 | #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT 0x21 | |
375 | #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX 0x22 | |
376 | #define GB_POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT 0x23 | |
377 | #define GB_POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN 0x24 | |
378 | #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN 0x25 | |
379 | #define GB_POWER_SUPPLY_PROP_ENERGY_FULL 0x26 | |
380 | #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY 0x27 | |
381 | #define GB_POWER_SUPPLY_PROP_ENERGY_NOW 0x28 | |
382 | #define GB_POWER_SUPPLY_PROP_ENERGY_AVG 0x29 | |
383 | #define GB_POWER_SUPPLY_PROP_CAPACITY 0x2A | |
384 | #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN 0x2B | |
385 | #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX 0x2C | |
386 | #define GB_POWER_SUPPLY_PROP_CAPACITY_LEVEL 0x2D | |
387 | #define GB_POWER_SUPPLY_PROP_TEMP 0x2E | |
388 | #define GB_POWER_SUPPLY_PROP_TEMP_MAX 0x2F | |
389 | #define GB_POWER_SUPPLY_PROP_TEMP_MIN 0x30 | |
390 | #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MIN 0x31 | |
391 | #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MAX 0x32 | |
392 | #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT 0x33 | |
393 | #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN 0x34 | |
394 | #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX 0x35 | |
395 | #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW 0x36 | |
396 | #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG 0x37 | |
397 | #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_NOW 0x38 | |
398 | #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_AVG 0x39 | |
399 | #define GB_POWER_SUPPLY_PROP_TYPE 0x3A | |
400 | #define GB_POWER_SUPPLY_PROP_SCOPE 0x3B | |
401 | #define GB_POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT 0x3C | |
402 | #define GB_POWER_SUPPLY_PROP_CALIBRATE 0x3D | |
403 | __u8 is_writeable; | |
b701686a | 404 | } __packed; |
ce832943 | 405 | |
ffe2e248 RMS |
406 | struct gb_power_supply_get_property_descriptors_request { |
407 | __u8 psy_id; | |
b701686a | 408 | } __packed; |
ce832943 | 409 | |
ffe2e248 RMS |
410 | struct gb_power_supply_get_property_descriptors_response { |
411 | __u8 properties_count; | |
412 | struct gb_power_supply_props_desc props[]; | |
b701686a | 413 | } __packed; |
ce832943 | 414 | |
ffe2e248 RMS |
415 | struct gb_power_supply_get_property_request { |
416 | __u8 psy_id; | |
417 | __u8 property; | |
418 | } __packed; | |
419 | ||
420 | struct gb_power_supply_get_property_response { | |
421 | __le32 prop_val; | |
422 | }; | |
423 | ||
424 | struct gb_power_supply_set_property_request { | |
425 | __u8 psy_id; | |
426 | __u8 property; | |
427 | __le32 prop_val; | |
b701686a | 428 | } __packed; |
ce832943 | 429 | |
ffe2e248 RMS |
430 | struct gb_power_supply_event_request { |
431 | __u8 psy_id; | |
432 | __u8 event; | |
433 | #define GB_POWER_SUPPLY_UPDATE 0x01 | |
b701686a | 434 | } __packed; |
ce832943 VK |
435 | |
436 | ||
51aee043 VK |
437 | /* HID */ |
438 | ||
439 | /* Version of the Greybus hid protocol we support */ | |
440 | #define GB_HID_VERSION_MAJOR 0x00 | |
441 | #define GB_HID_VERSION_MINOR 0x01 | |
442 | ||
443 | /* Greybus HID operation types */ | |
51aee043 VK |
444 | #define GB_HID_TYPE_GET_DESC 0x02 |
445 | #define GB_HID_TYPE_GET_REPORT_DESC 0x03 | |
446 | #define GB_HID_TYPE_PWR_ON 0x04 | |
447 | #define GB_HID_TYPE_PWR_OFF 0x05 | |
448 | #define GB_HID_TYPE_GET_REPORT 0x06 | |
449 | #define GB_HID_TYPE_SET_REPORT 0x07 | |
450 | #define GB_HID_TYPE_IRQ_EVENT 0x08 | |
451 | ||
452 | /* Report type */ | |
453 | #define GB_HID_INPUT_REPORT 0 | |
454 | #define GB_HID_OUTPUT_REPORT 1 | |
455 | #define GB_HID_FEATURE_REPORT 2 | |
456 | ||
457 | /* Different request/response structures */ | |
458 | /* HID get descriptor response */ | |
459 | struct gb_hid_desc_response { | |
460 | __u8 bLength; | |
461 | __le16 wReportDescLength; | |
462 | __le16 bcdHID; | |
463 | __le16 wProductID; | |
464 | __le16 wVendorID; | |
465 | __u8 bCountryCode; | |
466 | } __packed; | |
467 | ||
468 | /* HID get report request/response */ | |
469 | struct gb_hid_get_report_request { | |
470 | __u8 report_type; | |
471 | __u8 report_id; | |
b701686a | 472 | } __packed; |
51aee043 VK |
473 | |
474 | /* HID set report request */ | |
475 | struct gb_hid_set_report_request { | |
476 | __u8 report_type; | |
477 | __u8 report_id; | |
478 | __u8 report[0]; | |
b701686a | 479 | } __packed; |
51aee043 VK |
480 | |
481 | /* HID input report request, via interrupt pipe */ | |
482 | struct gb_hid_input_report_request { | |
483 | __u8 report[0]; | |
b701686a | 484 | } __packed; |
51aee043 VK |
485 | |
486 | ||
453bbea8 JS |
487 | /* I2C */ |
488 | ||
489 | /* Version of the Greybus i2c protocol we support */ | |
67c920b8 GKH |
490 | #define GB_I2C_VERSION_MAJOR 0x00 |
491 | #define GB_I2C_VERSION_MINOR 0x01 | |
453bbea8 JS |
492 | |
493 | /* Greybus i2c request types */ | |
67c920b8 GKH |
494 | #define GB_I2C_TYPE_FUNCTIONALITY 0x02 |
495 | #define GB_I2C_TYPE_TIMEOUT 0x03 | |
496 | #define GB_I2C_TYPE_RETRIES 0x04 | |
497 | #define GB_I2C_TYPE_TRANSFER 0x05 | |
453bbea8 | 498 | |
67c920b8 GKH |
499 | #define GB_I2C_RETRIES_DEFAULT 3 |
500 | #define GB_I2C_TIMEOUT_DEFAULT 1000 /* milliseconds */ | |
453bbea8 JS |
501 | |
502 | /* functionality request has no payload */ | |
503 | struct gb_i2c_functionality_response { | |
504 | __le32 functionality; | |
b701686a | 505 | } __packed; |
453bbea8 JS |
506 | |
507 | struct gb_i2c_timeout_request { | |
508 | __le16 msec; | |
b701686a | 509 | } __packed; |
453bbea8 JS |
510 | /* timeout response has no payload */ |
511 | ||
512 | struct gb_i2c_retries_request { | |
513 | __u8 retries; | |
b701686a | 514 | } __packed; |
453bbea8 JS |
515 | /* retries response has no payload */ |
516 | ||
517 | /* | |
518 | * Outgoing data immediately follows the op count and ops array. | |
519 | * The data for each write (master -> slave) op in the array is sent | |
520 | * in order, with no (e.g. pad) bytes separating them. | |
521 | * | |
522 | * Short reads cause the entire transfer request to fail So response | |
523 | * payload consists only of bytes read, and the number of bytes is | |
524 | * exactly what was specified in the corresponding op. Like | |
525 | * outgoing data, the incoming data is in order and contiguous. | |
526 | */ | |
527 | struct gb_i2c_transfer_op { | |
528 | __le16 addr; | |
529 | __le16 flags; | |
530 | __le16 size; | |
b701686a | 531 | } __packed; |
453bbea8 JS |
532 | |
533 | struct gb_i2c_transfer_request { | |
534 | __le16 op_count; | |
535 | struct gb_i2c_transfer_op ops[0]; /* op_count of these */ | |
b701686a | 536 | } __packed; |
453bbea8 JS |
537 | struct gb_i2c_transfer_response { |
538 | __u8 data[0]; /* inbound data */ | |
b701686a | 539 | } __packed; |
453bbea8 JS |
540 | |
541 | ||
542 | /* GPIO */ | |
543 | ||
544 | /* Version of the Greybus GPIO protocol we support */ | |
67c920b8 GKH |
545 | #define GB_GPIO_VERSION_MAJOR 0x00 |
546 | #define GB_GPIO_VERSION_MINOR 0x01 | |
453bbea8 JS |
547 | |
548 | /* Greybus GPIO request types */ | |
67c920b8 GKH |
549 | #define GB_GPIO_TYPE_LINE_COUNT 0x02 |
550 | #define GB_GPIO_TYPE_ACTIVATE 0x03 | |
551 | #define GB_GPIO_TYPE_DEACTIVATE 0x04 | |
552 | #define GB_GPIO_TYPE_GET_DIRECTION 0x05 | |
553 | #define GB_GPIO_TYPE_DIRECTION_IN 0x06 | |
554 | #define GB_GPIO_TYPE_DIRECTION_OUT 0x07 | |
555 | #define GB_GPIO_TYPE_GET_VALUE 0x08 | |
556 | #define GB_GPIO_TYPE_SET_VALUE 0x09 | |
557 | #define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a | |
453bbea8 | 558 | #define GB_GPIO_TYPE_IRQ_TYPE 0x0b |
47bf0b44 JH |
559 | #define GB_GPIO_TYPE_IRQ_MASK 0x0c |
560 | #define GB_GPIO_TYPE_IRQ_UNMASK 0x0d | |
561 | #define GB_GPIO_TYPE_IRQ_EVENT 0x0e | |
453bbea8 | 562 | |
7ba864a1 JH |
563 | #define GB_GPIO_IRQ_TYPE_NONE 0x00 |
564 | #define GB_GPIO_IRQ_TYPE_EDGE_RISING 0x01 | |
565 | #define GB_GPIO_IRQ_TYPE_EDGE_FALLING 0x02 | |
566 | #define GB_GPIO_IRQ_TYPE_EDGE_BOTH 0x03 | |
567 | #define GB_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04 | |
568 | #define GB_GPIO_IRQ_TYPE_LEVEL_LOW 0x08 | |
569 | ||
453bbea8 JS |
570 | /* line count request has no payload */ |
571 | struct gb_gpio_line_count_response { | |
572 | __u8 count; | |
b701686a | 573 | } __packed; |
453bbea8 JS |
574 | |
575 | struct gb_gpio_activate_request { | |
576 | __u8 which; | |
b701686a | 577 | } __packed; |
453bbea8 JS |
578 | /* activate response has no payload */ |
579 | ||
580 | struct gb_gpio_deactivate_request { | |
581 | __u8 which; | |
b701686a | 582 | } __packed; |
453bbea8 JS |
583 | /* deactivate response has no payload */ |
584 | ||
585 | struct gb_gpio_get_direction_request { | |
586 | __u8 which; | |
b701686a | 587 | } __packed; |
453bbea8 JS |
588 | struct gb_gpio_get_direction_response { |
589 | __u8 direction; | |
b701686a | 590 | } __packed; |
453bbea8 JS |
591 | |
592 | struct gb_gpio_direction_in_request { | |
593 | __u8 which; | |
b701686a | 594 | } __packed; |
453bbea8 JS |
595 | /* direction in response has no payload */ |
596 | ||
597 | struct gb_gpio_direction_out_request { | |
598 | __u8 which; | |
599 | __u8 value; | |
b701686a | 600 | } __packed; |
453bbea8 JS |
601 | /* direction out response has no payload */ |
602 | ||
603 | struct gb_gpio_get_value_request { | |
604 | __u8 which; | |
b701686a | 605 | } __packed; |
453bbea8 JS |
606 | struct gb_gpio_get_value_response { |
607 | __u8 value; | |
b701686a | 608 | } __packed; |
453bbea8 JS |
609 | |
610 | struct gb_gpio_set_value_request { | |
611 | __u8 which; | |
612 | __u8 value; | |
b701686a | 613 | } __packed; |
453bbea8 JS |
614 | /* set value response has no payload */ |
615 | ||
616 | struct gb_gpio_set_debounce_request { | |
617 | __u8 which; | |
5b559e64 JH |
618 | __le16 usec; |
619 | } __packed; | |
453bbea8 JS |
620 | /* debounce response has no payload */ |
621 | ||
622 | struct gb_gpio_irq_type_request { | |
623 | __u8 which; | |
624 | __u8 type; | |
b701686a | 625 | } __packed; |
453bbea8 JS |
626 | /* irq type response has no payload */ |
627 | ||
628 | struct gb_gpio_irq_mask_request { | |
629 | __u8 which; | |
b701686a | 630 | } __packed; |
453bbea8 JS |
631 | /* irq mask response has no payload */ |
632 | ||
633 | struct gb_gpio_irq_unmask_request { | |
634 | __u8 which; | |
b701686a | 635 | } __packed; |
453bbea8 JS |
636 | /* irq unmask response has no payload */ |
637 | ||
453bbea8 JS |
638 | /* irq event requests originate on another module and are handled on the AP */ |
639 | struct gb_gpio_irq_event_request { | |
640 | __u8 which; | |
b701686a | 641 | } __packed; |
1409c4d6 | 642 | /* irq event has no response */ |
453bbea8 JS |
643 | |
644 | ||
645 | /* PWM */ | |
646 | ||
647 | /* Version of the Greybus PWM protocol we support */ | |
67c920b8 GKH |
648 | #define GB_PWM_VERSION_MAJOR 0x00 |
649 | #define GB_PWM_VERSION_MINOR 0x01 | |
453bbea8 | 650 | |
6d653370 | 651 | /* Greybus PWM operation types */ |
67c920b8 GKH |
652 | #define GB_PWM_TYPE_PWM_COUNT 0x02 |
653 | #define GB_PWM_TYPE_ACTIVATE 0x03 | |
654 | #define GB_PWM_TYPE_DEACTIVATE 0x04 | |
655 | #define GB_PWM_TYPE_CONFIG 0x05 | |
656 | #define GB_PWM_TYPE_POLARITY 0x06 | |
657 | #define GB_PWM_TYPE_ENABLE 0x07 | |
658 | #define GB_PWM_TYPE_DISABLE 0x08 | |
453bbea8 JS |
659 | |
660 | /* pwm count request has no payload */ | |
661 | struct gb_pwm_count_response { | |
662 | __u8 count; | |
b701686a | 663 | } __packed; |
453bbea8 JS |
664 | |
665 | struct gb_pwm_activate_request { | |
666 | __u8 which; | |
b701686a | 667 | } __packed; |
453bbea8 JS |
668 | |
669 | struct gb_pwm_deactivate_request { | |
670 | __u8 which; | |
b701686a | 671 | } __packed; |
453bbea8 JS |
672 | |
673 | struct gb_pwm_config_request { | |
674 | __u8 which; | |
5b559e64 JH |
675 | __le32 duty; |
676 | __le32 period; | |
677 | } __packed; | |
453bbea8 JS |
678 | |
679 | struct gb_pwm_polarity_request { | |
680 | __u8 which; | |
681 | __u8 polarity; | |
b701686a | 682 | } __packed; |
453bbea8 JS |
683 | |
684 | struct gb_pwm_enable_request { | |
685 | __u8 which; | |
b701686a | 686 | } __packed; |
453bbea8 JS |
687 | |
688 | struct gb_pwm_disable_request { | |
689 | __u8 which; | |
b701686a | 690 | } __packed; |
453bbea8 | 691 | |
4890f319 VK |
692 | /* SPI */ |
693 | ||
694 | /* Version of the Greybus spi protocol we support */ | |
695 | #define GB_SPI_VERSION_MAJOR 0x00 | |
696 | #define GB_SPI_VERSION_MINOR 0x01 | |
697 | ||
698 | /* Should match up with modes in linux/spi/spi.h */ | |
699 | #define GB_SPI_MODE_CPHA 0x01 /* clock phase */ | |
700 | #define GB_SPI_MODE_CPOL 0x02 /* clock polarity */ | |
701 | #define GB_SPI_MODE_MODE_0 (0|0) /* (original MicroWire) */ | |
702 | #define GB_SPI_MODE_MODE_1 (0|GB_SPI_MODE_CPHA) | |
703 | #define GB_SPI_MODE_MODE_2 (GB_SPI_MODE_CPOL|0) | |
704 | #define GB_SPI_MODE_MODE_3 (GB_SPI_MODE_CPOL|GB_SPI_MODE_CPHA) | |
705 | #define GB_SPI_MODE_CS_HIGH 0x04 /* chipselect active high? */ | |
706 | #define GB_SPI_MODE_LSB_FIRST 0x08 /* per-word bits-on-wire */ | |
707 | #define GB_SPI_MODE_3WIRE 0x10 /* SI/SO signals shared */ | |
708 | #define GB_SPI_MODE_LOOP 0x20 /* loopback mode */ | |
709 | #define GB_SPI_MODE_NO_CS 0x40 /* 1 dev/bus, no chipselect */ | |
710 | #define GB_SPI_MODE_READY 0x80 /* slave pulls low to pause */ | |
711 | ||
712 | /* Should match up with flags in linux/spi/spi.h */ | |
713 | #define GB_SPI_FLAG_HALF_DUPLEX BIT(0) /* can't do full duplex */ | |
714 | #define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */ | |
715 | #define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */ | |
716 | ||
717 | /* Greybus spi operation types */ | |
b343f6af RMS |
718 | #define GB_SPI_TYPE_MASTER_CONFIG 0x02 |
719 | #define GB_SPI_TYPE_DEVICE_CONFIG 0x03 | |
720 | #define GB_SPI_TYPE_TRANSFER 0x04 | |
4890f319 VK |
721 | |
722 | /* mode request has no payload */ | |
b343f6af RMS |
723 | struct gb_spi_master_config_response { |
724 | __le32 bits_per_word_mask; | |
725 | __le32 min_speed_hz; | |
726 | __le32 max_speed_hz; | |
4890f319 | 727 | __le16 mode; |
4890f319 | 728 | __le16 flags; |
50014e07 | 729 | __u8 num_chipselect; |
b701686a | 730 | } __packed; |
4890f319 | 731 | |
b343f6af | 732 | struct gb_spi_device_config_request { |
50014e07 | 733 | __u8 chip_select; |
b701686a | 734 | } __packed; |
4890f319 | 735 | |
b343f6af RMS |
736 | struct gb_spi_device_config_response { |
737 | __le16 mode; | |
738 | __u8 bits_per_word; | |
739 | __le32 max_speed_hz; | |
0273038d RMS |
740 | __u8 device_type; |
741 | #define GB_SPI_SPI_DEV 0x00 | |
742 | #define GB_SPI_SPI_NOR 0x01 | |
743 | #define GB_SPI_SPI_MODALIAS 0x02 | |
b343f6af | 744 | __u8 name[32]; |
b701686a | 745 | } __packed; |
4890f319 VK |
746 | |
747 | /** | |
748 | * struct gb_spi_transfer - a read/write buffer pair | |
749 | * @speed_hz: Select a speed other than the device default for this transfer. If | |
750 | * 0 the default (from @spi_device) is used. | |
751 | * @len: size of rx and tx buffers (in bytes) | |
752 | * @delay_usecs: microseconds to delay after this transfer before (optionally) | |
753 | * changing the chipselect status, then starting the next transfer or | |
754 | * completing this spi_message. | |
755 | * @cs_change: affects chipselect after this transfer completes | |
756 | * @bits_per_word: select a bits_per_word other than the device default for this | |
757 | * transfer. If 0 the default (from @spi_device) is used. | |
758 | */ | |
759 | struct gb_spi_transfer { | |
760 | __le32 speed_hz; | |
761 | __le32 len; | |
762 | __le16 delay_usecs; | |
763 | __u8 cs_change; | |
764 | __u8 bits_per_word; | |
b455c846 RMS |
765 | __u8 rdwr; |
766 | #define GB_SPI_XFER_READ 0x01 | |
767 | #define GB_SPI_XFER_WRITE 0x02 | |
b701686a | 768 | } __packed; |
4890f319 VK |
769 | |
770 | struct gb_spi_transfer_request { | |
771 | __u8 chip_select; /* of the spi device */ | |
772 | __u8 mode; /* of the spi device */ | |
773 | __le16 count; | |
46d26c5d | 774 | struct gb_spi_transfer transfers[0]; /* count of these */ |
b701686a | 775 | } __packed; |
4890f319 VK |
776 | |
777 | struct gb_spi_transfer_response { | |
778 | __u8 data[0]; /* inbound data */ | |
b701686a | 779 | } __packed; |
4890f319 | 780 | |
30c6d9d7 AE |
781 | /* Version of the Greybus SVC protocol we support */ |
782 | #define GB_SVC_VERSION_MAJOR 0x00 | |
783 | #define GB_SVC_VERSION_MINOR 0x01 | |
784 | ||
785 | /* Greybus SVC request types */ | |
ead35460 VK |
786 | #define GB_SVC_TYPE_SVC_HELLO 0x02 |
787 | #define GB_SVC_TYPE_INTF_DEVICE_ID 0x03 | |
788 | #define GB_SVC_TYPE_INTF_HOTPLUG 0x04 | |
789 | #define GB_SVC_TYPE_INTF_HOT_UNPLUG 0x05 | |
790 | #define GB_SVC_TYPE_INTF_RESET 0x06 | |
791 | #define GB_SVC_TYPE_CONN_CREATE 0x07 | |
792 | #define GB_SVC_TYPE_CONN_DESTROY 0x08 | |
19151c3d VK |
793 | #define GB_SVC_TYPE_DME_PEER_GET 0x09 |
794 | #define GB_SVC_TYPE_DME_PEER_SET 0x0a | |
e08aaa49 | 795 | #define GB_SVC_TYPE_ROUTE_CREATE 0x0b |
0a020570 | 796 | #define GB_SVC_TYPE_ROUTE_DESTROY 0x0c |
aab4a1a3 | 797 | #define GB_SVC_TYPE_INTF_SET_PWRM 0x10 |
c5d55fb3 | 798 | #define GB_SVC_TYPE_INTF_EJECT 0x11 |
ebe99d61 | 799 | #define GB_SVC_TYPE_KEY_EVENT 0x12 |
55ec09e8 | 800 | #define GB_SVC_TYPE_PING 0x13 |
ead35460 | 801 | |
cfb16906 JH |
802 | /* |
803 | * SVC version request/response has the same payload as | |
804 | * gb_protocol_version_request/response. | |
805 | */ | |
ead35460 VK |
806 | |
807 | /* SVC protocol hello request */ | |
808 | struct gb_svc_hello_request { | |
809 | __le16 endo_id; | |
810 | __u8 interface_id; | |
2130f098 | 811 | } __packed; |
ead35460 | 812 | /* hello response has no payload */ |
30c6d9d7 AE |
813 | |
814 | struct gb_svc_intf_device_id_request { | |
815 | __u8 intf_id; | |
816 | __u8 device_id; | |
829a91e7 | 817 | } __packed; |
30c6d9d7 AE |
818 | /* device id response has no payload */ |
819 | ||
820 | struct gb_svc_intf_hotplug_request { | |
821 | __u8 intf_id; | |
822 | struct { | |
b32a5c53 VK |
823 | __le32 ddbl1_mfr_id; |
824 | __le32 ddbl1_prod_id; | |
30c6d9d7 AE |
825 | __le32 ara_vend_id; |
826 | __le32 ara_prod_id; | |
57c6bcc6 | 827 | __le64 serial_number; |
30c6d9d7 | 828 | } data; |
2130f098 | 829 | } __packed; |
30c6d9d7 AE |
830 | /* hotplug response has no payload */ |
831 | ||
832 | struct gb_svc_intf_hot_unplug_request { | |
833 | __u8 intf_id; | |
829a91e7 | 834 | } __packed; |
30c6d9d7 AE |
835 | /* hot unplug response has no payload */ |
836 | ||
837 | struct gb_svc_intf_reset_request { | |
838 | __u8 intf_id; | |
829a91e7 | 839 | } __packed; |
30c6d9d7 AE |
840 | /* interface reset response has no payload */ |
841 | ||
c5d55fb3 RMS |
842 | #define GB_SVC_EJECT_TIME 9000 |
843 | struct gb_svc_intf_eject_request { | |
844 | __u8 intf_id; | |
845 | } __packed; | |
846 | /* interface eject response has no payload */ | |
847 | ||
30c6d9d7 AE |
848 | struct gb_svc_conn_create_request { |
849 | __u8 intf1_id; | |
2498050b | 850 | __le16 cport1_id; |
30c6d9d7 | 851 | __u8 intf2_id; |
2498050b | 852 | __le16 cport2_id; |
0b226497 PH |
853 | __u8 tc; |
854 | __u8 flags; | |
2130f098 | 855 | } __packed; |
30c6d9d7 AE |
856 | /* connection create response has no payload */ |
857 | ||
858 | struct gb_svc_conn_destroy_request { | |
859 | __u8 intf1_id; | |
2498050b | 860 | __le16 cport1_id; |
30c6d9d7 | 861 | __u8 intf2_id; |
2498050b | 862 | __le16 cport2_id; |
2130f098 | 863 | } __packed; |
30c6d9d7 AE |
864 | /* connection destroy response has no payload */ |
865 | ||
19151c3d VK |
866 | struct gb_svc_dme_peer_get_request { |
867 | __u8 intf_id; | |
2498050b RMS |
868 | __le16 attr; |
869 | __le16 selector; | |
19151c3d VK |
870 | } __packed; |
871 | ||
872 | struct gb_svc_dme_peer_get_response { | |
2498050b RMS |
873 | __le16 result_code; |
874 | __le32 attr_value; | |
19151c3d VK |
875 | } __packed; |
876 | ||
877 | struct gb_svc_dme_peer_set_request { | |
878 | __u8 intf_id; | |
2498050b RMS |
879 | __le16 attr; |
880 | __le16 selector; | |
881 | __le32 value; | |
19151c3d VK |
882 | } __packed; |
883 | ||
884 | struct gb_svc_dme_peer_set_response { | |
2498050b | 885 | __le16 result_code; |
19151c3d VK |
886 | } __packed; |
887 | ||
6bec5c78 VK |
888 | /* Attributes for peer get/set operations */ |
889 | #define DME_ATTR_SELECTOR_INDEX 0 | |
3563ff88 | 890 | /* FIXME: remove ES2 support and DME_ATTR_T_TST_SRC_INCREMENT */ |
6bec5c78 | 891 | #define DME_ATTR_T_TST_SRC_INCREMENT 0x4083 |
3563ff88 ES |
892 | #define DME_ATTR_ES3_INIT_STATUS 0x6101 |
893 | ||
894 | /* Return value from init-status attributes listed above */ | |
895 | #define DME_DIS_SPI_BOOT_STARTED 0x02 | |
896 | #define DME_DIS_TRUSTED_SPI_BOOT_FINISHED 0x03 | |
897 | #define DME_DIS_UNTRUSTED_SPI_BOOT_FINISHED 0x04 | |
898 | #define DME_DIS_UNIPRO_BOOT_STARTED 0x06 | |
899 | #define DME_DIS_FALLBACK_UNIPRO_BOOT_STARTED 0x09 | |
1575ef18 | 900 | |
e08aaa49 PH |
901 | struct gb_svc_route_create_request { |
902 | __u8 intf1_id; | |
903 | __u8 dev1_id; | |
904 | __u8 intf2_id; | |
905 | __u8 dev2_id; | |
829a91e7 | 906 | } __packed; |
d6ec7872 | 907 | /* route create response has no payload */ |
e08aaa49 | 908 | |
0a020570 VK |
909 | struct gb_svc_route_destroy_request { |
910 | __u8 intf1_id; | |
911 | __u8 intf2_id; | |
912 | } __packed; | |
913 | /* route destroy response has no payload */ | |
914 | ||
aab4a1a3 LP |
915 | #define GB_SVC_UNIPRO_FAST_MODE 0x01 |
916 | #define GB_SVC_UNIPRO_SLOW_MODE 0x02 | |
917 | #define GB_SVC_UNIPRO_FAST_AUTO_MODE 0x04 | |
918 | #define GB_SVC_UNIPRO_SLOW_AUTO_MODE 0x05 | |
919 | #define GB_SVC_UNIPRO_MODE_UNCHANGED 0x07 | |
920 | #define GB_SVC_UNIPRO_HIBERNATE_MODE 0x11 | |
921 | #define GB_SVC_UNIPRO_OFF_MODE 0x12 | |
922 | ||
923 | #define GB_SVC_PWRM_RXTERMINATION 0x01 | |
924 | #define GB_SVC_PWRM_TXTERMINATION 0x02 | |
925 | #define GB_SVC_PWRM_LINE_RESET 0x04 | |
926 | #define GB_SVC_PWRM_SCRAMBLING 0x20 | |
927 | ||
928 | #define GB_SVC_PWRM_QUIRK_HSSER 0x00000001 | |
929 | ||
930 | #define GB_SVC_UNIPRO_HS_SERIES_A 0x01 | |
931 | #define GB_SVC_UNIPRO_HS_SERIES_B 0x02 | |
932 | ||
933 | struct gb_svc_intf_set_pwrm_request { | |
934 | __u8 intf_id; | |
935 | __u8 hs_series; | |
936 | __u8 tx_mode; | |
937 | __u8 tx_gear; | |
938 | __u8 tx_nlanes; | |
939 | __u8 rx_mode; | |
940 | __u8 rx_gear; | |
941 | __u8 rx_nlanes; | |
942 | __u8 flags; | |
943 | __le32 quirks; | |
944 | } __packed; | |
945 | ||
946 | struct gb_svc_intf_set_pwrm_response { | |
947 | __le16 result_code; | |
948 | } __packed; | |
d65e3a22 | 949 | |
ebe99d61 RMS |
950 | struct gb_svc_key_event_request { |
951 | __le16 key_code; | |
952 | #define GB_KEYCODE_ARA 0x00 | |
953 | ||
954 | __u8 key_event; | |
955 | #define GB_SVC_KEY_RELEASED 0x00 | |
956 | #define GB_SVC_KEY_PRESSED 0x01 | |
957 | } __packed; | |
958 | ||
d65e3a22 VK |
959 | /* RAW */ |
960 | ||
961 | /* Version of the Greybus raw protocol we support */ | |
962 | #define GB_RAW_VERSION_MAJOR 0x00 | |
963 | #define GB_RAW_VERSION_MINOR 0x01 | |
964 | ||
965 | /* Greybus raw request types */ | |
966 | #define GB_RAW_TYPE_SEND 0x02 | |
967 | ||
968 | struct gb_raw_send_request { | |
969 | __le32 len; | |
970 | __u8 data[0]; | |
b701686a | 971 | } __packed; |
d65e3a22 VK |
972 | |
973 | ||
4ef53485 BD |
974 | /* UART */ |
975 | ||
976 | /* Version of the Greybus UART protocol we support */ | |
977 | #define GB_UART_VERSION_MAJOR 0x00 | |
978 | #define GB_UART_VERSION_MINOR 0x01 | |
979 | ||
980 | /* Greybus UART operation types */ | |
4ef53485 BD |
981 | #define GB_UART_TYPE_SEND_DATA 0x02 |
982 | #define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */ | |
983 | #define GB_UART_TYPE_SET_LINE_CODING 0x04 | |
984 | #define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05 | |
a5192032 | 985 | #define GB_UART_TYPE_SEND_BREAK 0x06 |
4ef53485 BD |
986 | #define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */ |
987 | ||
11fca140 | 988 | /* Represents data from AP -> Module */ |
4ef53485 BD |
989 | struct gb_uart_send_data_request { |
990 | __le16 size; | |
991 | __u8 data[0]; | |
b701686a | 992 | } __packed; |
4ef53485 | 993 | |
802362d4 BD |
994 | /* recv-data-request flags */ |
995 | #define GB_UART_RECV_FLAG_FRAMING 0x01 /* Framing error */ | |
996 | #define GB_UART_RECV_FLAG_PARITY 0x02 /* Parity error */ | |
997 | #define GB_UART_RECV_FLAG_OVERRUN 0x04 /* Overrun error */ | |
998 | #define GB_UART_RECV_FLAG_BREAK 0x08 /* Break */ | |
999 | ||
11fca140 BD |
1000 | /* Represents data from Module -> AP */ |
1001 | struct gb_uart_recv_data_request { | |
1002 | __le16 size; | |
802362d4 | 1003 | __u8 flags; |
11fca140 | 1004 | __u8 data[0]; |
cfc5f2c6 | 1005 | } __packed; |
11fca140 BD |
1006 | |
1007 | struct gb_uart_set_line_coding_request { | |
4ef53485 BD |
1008 | __le32 rate; |
1009 | __u8 format; | |
11fca140 BD |
1010 | #define GB_SERIAL_1_STOP_BITS 0 |
1011 | #define GB_SERIAL_1_5_STOP_BITS 1 | |
1012 | #define GB_SERIAL_2_STOP_BITS 2 | |
4ef53485 BD |
1013 | |
1014 | __u8 parity; | |
11fca140 BD |
1015 | #define GB_SERIAL_NO_PARITY 0 |
1016 | #define GB_SERIAL_ODD_PARITY 1 | |
1017 | #define GB_SERIAL_EVEN_PARITY 2 | |
1018 | #define GB_SERIAL_MARK_PARITY 3 | |
1019 | #define GB_SERIAL_SPACE_PARITY 4 | |
4ef53485 | 1020 | |
11fca140 | 1021 | __u8 data_bits; |
cfc5f2c6 | 1022 | } __packed; |
4ef53485 BD |
1023 | |
1024 | /* output control lines */ | |
11fca140 BD |
1025 | #define GB_UART_CTRL_DTR 0x01 |
1026 | #define GB_UART_CTRL_RTS 0x02 | |
4ef53485 BD |
1027 | |
1028 | struct gb_uart_set_control_line_state_request { | |
ba4b099c | 1029 | __u8 control; |
b701686a | 1030 | } __packed; |
4ef53485 BD |
1031 | |
1032 | struct gb_uart_set_break_request { | |
1033 | __u8 state; | |
b701686a | 1034 | } __packed; |
4ef53485 BD |
1035 | |
1036 | /* input control lines and line errors */ | |
11fca140 BD |
1037 | #define GB_UART_CTRL_DCD 0x01 |
1038 | #define GB_UART_CTRL_DSR 0x02 | |
802362d4 | 1039 | #define GB_UART_CTRL_RI 0x04 |
4ef53485 BD |
1040 | |
1041 | struct gb_uart_serial_state_request { | |
ba4b099c | 1042 | __u8 control; |
b701686a | 1043 | } __packed; |
4ef53485 | 1044 | |
f9f971a2 BD |
1045 | /* Loopback */ |
1046 | ||
1047 | /* Version of the Greybus loopback protocol we support */ | |
52af141b BD |
1048 | #define GB_LOOPBACK_VERSION_MAJOR 0x00 |
1049 | #define GB_LOOPBACK_VERSION_MINOR 0x01 | |
f9f971a2 BD |
1050 | |
1051 | /* Greybus loopback request types */ | |
52af141b BD |
1052 | #define GB_LOOPBACK_TYPE_PING 0x02 |
1053 | #define GB_LOOPBACK_TYPE_TRANSFER 0x03 | |
384a7a3c | 1054 | #define GB_LOOPBACK_TYPE_SINK 0x04 |
f9f971a2 | 1055 | |
b59281ac AH |
1056 | /* |
1057 | * Loopback request/response header format should be identical | |
1058 | * to simplify bandwidth and data movement analysis. | |
1059 | */ | |
f9f971a2 BD |
1060 | struct gb_loopback_transfer_request { |
1061 | __le32 len; | |
b59281ac AH |
1062 | __le32 reserved0; |
1063 | __le32 reserved1; | |
f9f971a2 | 1064 | __u8 data[0]; |
b701686a | 1065 | } __packed; |
f9f971a2 BD |
1066 | |
1067 | struct gb_loopback_transfer_response { | |
4a655ad4 | 1068 | __le32 len; |
04db3346 BD |
1069 | __le32 reserved0; |
1070 | __le32 reserved1; | |
f9f971a2 | 1071 | __u8 data[0]; |
b701686a | 1072 | } __packed; |
f9f971a2 | 1073 | |
3b6ecd6d RMS |
1074 | /* SDIO */ |
1075 | /* Version of the Greybus sdio protocol we support */ | |
1076 | #define GB_SDIO_VERSION_MAJOR 0x00 | |
1077 | #define GB_SDIO_VERSION_MINOR 0x01 | |
1078 | ||
3b6ecd6d | 1079 | /* Greybus SDIO operation types */ |
3b6ecd6d RMS |
1080 | #define GB_SDIO_TYPE_GET_CAPABILITIES 0x02 |
1081 | #define GB_SDIO_TYPE_SET_IOS 0x03 | |
1082 | #define GB_SDIO_TYPE_COMMAND 0x04 | |
1083 | #define GB_SDIO_TYPE_TRANSFER 0x05 | |
1084 | #define GB_SDIO_TYPE_EVENT 0x06 | |
1085 | ||
1086 | /* get caps response: request has no payload */ | |
1087 | struct gb_sdio_get_caps_response { | |
1088 | __le32 caps; | |
1089 | #define GB_SDIO_CAP_NONREMOVABLE 0x00000001 | |
1090 | #define GB_SDIO_CAP_4_BIT_DATA 0x00000002 | |
1091 | #define GB_SDIO_CAP_8_BIT_DATA 0x00000004 | |
1092 | #define GB_SDIO_CAP_MMC_HS 0x00000008 | |
1093 | #define GB_SDIO_CAP_SD_HS 0x00000010 | |
1094 | #define GB_SDIO_CAP_ERASE 0x00000020 | |
1095 | #define GB_SDIO_CAP_1_2V_DDR 0x00000040 | |
1096 | #define GB_SDIO_CAP_1_8V_DDR 0x00000080 | |
1097 | #define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100 | |
1098 | #define GB_SDIO_CAP_UHS_SDR12 0x00000200 | |
1099 | #define GB_SDIO_CAP_UHS_SDR25 0x00000400 | |
1100 | #define GB_SDIO_CAP_UHS_SDR50 0x00000800 | |
1101 | #define GB_SDIO_CAP_UHS_SDR104 0x00001000 | |
1102 | #define GB_SDIO_CAP_UHS_DDR50 0x00002000 | |
1103 | #define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000 | |
1104 | #define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000 | |
1105 | #define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000 | |
1106 | #define GB_SDIO_CAP_HS200_1_2V 0x00020000 | |
1107 | #define GB_SDIO_CAP_HS200_1_8V 0x00040000 | |
1108 | #define GB_SDIO_CAP_HS400_1_2V 0x00080000 | |
1109 | #define GB_SDIO_CAP_HS400_1_8V 0x00100000 | |
1110 | ||
1111 | /* see possible values below at vdd */ | |
1112 | __le32 ocr; | |
1113 | __le16 max_blk_count; | |
1114 | __le16 max_blk_size; | |
e0f875c3 RMS |
1115 | __le32 f_min; |
1116 | __le32 f_max; | |
b701686a | 1117 | } __packed; |
3b6ecd6d RMS |
1118 | |
1119 | /* set ios request: response has no payload */ | |
1120 | struct gb_sdio_set_ios_request { | |
1121 | __le32 clock; | |
1122 | __le32 vdd; | |
1123 | #define GB_SDIO_VDD_165_195 0x00000001 | |
1124 | #define GB_SDIO_VDD_20_21 0x00000002 | |
1125 | #define GB_SDIO_VDD_21_22 0x00000004 | |
1126 | #define GB_SDIO_VDD_22_23 0x00000008 | |
1127 | #define GB_SDIO_VDD_23_24 0x00000010 | |
1128 | #define GB_SDIO_VDD_24_25 0x00000020 | |
1129 | #define GB_SDIO_VDD_25_26 0x00000040 | |
1130 | #define GB_SDIO_VDD_26_27 0x00000080 | |
1131 | #define GB_SDIO_VDD_27_28 0x00000100 | |
1132 | #define GB_SDIO_VDD_28_29 0x00000200 | |
1133 | #define GB_SDIO_VDD_29_30 0x00000400 | |
1134 | #define GB_SDIO_VDD_30_31 0x00000800 | |
1135 | #define GB_SDIO_VDD_31_32 0x00001000 | |
1136 | #define GB_SDIO_VDD_32_33 0x00002000 | |
1137 | #define GB_SDIO_VDD_33_34 0x00004000 | |
1138 | #define GB_SDIO_VDD_34_35 0x00008000 | |
1139 | #define GB_SDIO_VDD_35_36 0x00010000 | |
1140 | ||
1141 | __u8 bus_mode; | |
1142 | #define GB_SDIO_BUSMODE_OPENDRAIN 0x00 | |
1143 | #define GB_SDIO_BUSMODE_PUSHPULL 0x01 | |
1144 | ||
1145 | __u8 power_mode; | |
1146 | #define GB_SDIO_POWER_OFF 0x00 | |
1147 | #define GB_SDIO_POWER_UP 0x01 | |
1148 | #define GB_SDIO_POWER_ON 0x02 | |
1149 | #define GB_SDIO_POWER_UNDEFINED 0x03 | |
1150 | ||
1151 | __u8 bus_width; | |
1152 | #define GB_SDIO_BUS_WIDTH_1 0x00 | |
1153 | #define GB_SDIO_BUS_WIDTH_4 0x02 | |
1154 | #define GB_SDIO_BUS_WIDTH_8 0x03 | |
1155 | ||
1156 | __u8 timing; | |
1157 | #define GB_SDIO_TIMING_LEGACY 0x00 | |
1158 | #define GB_SDIO_TIMING_MMC_HS 0x01 | |
1159 | #define GB_SDIO_TIMING_SD_HS 0x02 | |
1160 | #define GB_SDIO_TIMING_UHS_SDR12 0x03 | |
1161 | #define GB_SDIO_TIMING_UHS_SDR25 0x04 | |
1162 | #define GB_SDIO_TIMING_UHS_SDR50 0x05 | |
1163 | #define GB_SDIO_TIMING_UHS_SDR104 0x06 | |
1164 | #define GB_SDIO_TIMING_UHS_DDR50 0x07 | |
1165 | #define GB_SDIO_TIMING_MMC_DDR52 0x08 | |
1166 | #define GB_SDIO_TIMING_MMC_HS200 0x09 | |
1167 | #define GB_SDIO_TIMING_MMC_HS400 0x0A | |
1168 | ||
1169 | __u8 signal_voltage; | |
1170 | #define GB_SDIO_SIGNAL_VOLTAGE_330 0x00 | |
1171 | #define GB_SDIO_SIGNAL_VOLTAGE_180 0x01 | |
1172 | #define GB_SDIO_SIGNAL_VOLTAGE_120 0x02 | |
1173 | ||
1174 | __u8 drv_type; | |
1175 | #define GB_SDIO_SET_DRIVER_TYPE_B 0x00 | |
1176 | #define GB_SDIO_SET_DRIVER_TYPE_A 0x01 | |
1177 | #define GB_SDIO_SET_DRIVER_TYPE_C 0x02 | |
1178 | #define GB_SDIO_SET_DRIVER_TYPE_D 0x03 | |
8bbd9edc | 1179 | } __packed; |
3b6ecd6d RMS |
1180 | |
1181 | /* command request */ | |
1182 | struct gb_sdio_command_request { | |
1183 | __u8 cmd; | |
1184 | __u8 cmd_flags; | |
1185 | #define GB_SDIO_RSP_NONE 0x00 | |
ef0cc0ec RMS |
1186 | #define GB_SDIO_RSP_PRESENT 0x01 |
1187 | #define GB_SDIO_RSP_136 0x02 | |
1188 | #define GB_SDIO_RSP_CRC 0x04 | |
1189 | #define GB_SDIO_RSP_BUSY 0x08 | |
1190 | #define GB_SDIO_RSP_OPCODE 0x10 | |
3b6ecd6d RMS |
1191 | |
1192 | __u8 cmd_type; | |
1193 | #define GB_SDIO_CMD_AC 0x00 | |
1194 | #define GB_SDIO_CMD_ADTC 0x01 | |
2d465d57 RMS |
1195 | #define GB_SDIO_CMD_BC 0x02 |
1196 | #define GB_SDIO_CMD_BCR 0x03 | |
3b6ecd6d RMS |
1197 | |
1198 | __le32 cmd_arg; | |
10ed1938 RMS |
1199 | __le16 data_blocks; |
1200 | __le16 data_blksz; | |
8bbd9edc | 1201 | } __packed; |
3b6ecd6d RMS |
1202 | |
1203 | struct gb_sdio_command_response { | |
1204 | __le32 resp[4]; | |
b701686a | 1205 | } __packed; |
3b6ecd6d RMS |
1206 | |
1207 | /* transfer request */ | |
1208 | struct gb_sdio_transfer_request { | |
1209 | __u8 data_flags; | |
1210 | #define GB_SDIO_DATA_WRITE 0x01 | |
1211 | #define GB_SDIO_DATA_READ 0x02 | |
1212 | #define GB_SDIO_DATA_STREAM 0x04 | |
1213 | ||
1214 | __le16 data_blocks; | |
1215 | __le16 data_blksz; | |
1216 | __u8 data[0]; | |
8bbd9edc | 1217 | } __packed; |
3b6ecd6d RMS |
1218 | |
1219 | struct gb_sdio_transfer_response { | |
1220 | __le16 data_blocks; | |
1221 | __le16 data_blksz; | |
1222 | __u8 data[0]; | |
b701686a | 1223 | } __packed; |
3b6ecd6d RMS |
1224 | |
1225 | /* event request: generated by module and is defined as unidirectional */ | |
1226 | struct gb_sdio_event_request { | |
1227 | __u8 event; | |
1228 | #define GB_SDIO_CARD_INSERTED 0x01 | |
1229 | #define GB_SDIO_CARD_REMOVED 0x02 | |
1230 | #define GB_SDIO_WP 0x04 | |
b701686a | 1231 | } __packed; |
3b6ecd6d | 1232 | |
e61a2a71 LP |
1233 | /* Camera */ |
1234 | ||
1235 | #define GB_CAMERA_VERSION_MAJOR 0x00 | |
1236 | #define GB_CAMERA_VERSION_MINOR 0x01 | |
1237 | ||
1238 | /* Greybus Camera request types */ | |
1239 | #define GB_CAMERA_TYPE_CAPABILITIES 0x02 | |
1240 | #define GB_CAMERA_TYPE_CONFIGURE_STREAMS 0x03 | |
1241 | #define GB_CAMERA_TYPE_CAPTURE 0x04 | |
1242 | #define GB_CAMERA_TYPE_FLUSH 0x05 | |
1243 | #define GB_CAMERA_TYPE_METADATA 0x06 | |
1244 | ||
1245 | #define GB_CAMERA_MAX_STREAMS 4 | |
1246 | #define GB_CAMERA_MAX_SETTINGS_SIZE 8192 | |
1247 | ||
1248 | /* Greybus Camera Configure Streams request payload */ | |
1249 | struct gb_camera_stream_config_request { | |
1250 | __le16 width; | |
1251 | __le16 height; | |
1252 | __le16 format; | |
1253 | __le16 padding; | |
1254 | } __packed; | |
1255 | ||
1256 | struct gb_camera_configure_streams_request { | |
b787d413 JM |
1257 | __u8 num_streams; |
1258 | __u8 flags; | |
1259 | #define GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY 0x01 | |
e61a2a71 LP |
1260 | __le16 padding; |
1261 | struct gb_camera_stream_config_request config[0]; | |
1262 | } __packed; | |
1263 | ||
1264 | /* Greybus Camera Configure Streams response payload */ | |
1265 | struct gb_camera_stream_config_response { | |
1266 | __le16 width; | |
1267 | __le16 height; | |
1268 | __le16 format; | |
1269 | __u8 virtual_channel; | |
1270 | __u8 data_type[2]; | |
1271 | __u8 padding[3]; | |
1272 | __le32 max_size; | |
1273 | } __packed; | |
1274 | ||
1275 | struct gb_camera_configure_streams_response { | |
b787d413 | 1276 | __u8 num_streams; |
8e77c83e | 1277 | __u8 flags; |
b787d413 | 1278 | #define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED 0x01 |
446091c9 JM |
1279 | __u8 num_lanes; |
1280 | __u8 padding; | |
1281 | __le32 bus_freq; | |
1282 | __le32 lines_per_second; | |
e61a2a71 LP |
1283 | struct gb_camera_stream_config_response config[0]; |
1284 | } __packed; | |
1285 | ||
1286 | /* Greybus Camera Capture request payload - response has no payload */ | |
1287 | struct gb_camera_capture_request { | |
1288 | __le32 request_id; | |
8e77c83e RMS |
1289 | __u8 streams; |
1290 | __u8 padding; | |
e61a2a71 | 1291 | __le16 num_frames; |
8e77c83e | 1292 | __u8 settings[0]; |
e61a2a71 LP |
1293 | } __packed; |
1294 | ||
1295 | /* Greybus Camera Flush response payload - request has no payload */ | |
1296 | struct gb_camera_flush_response { | |
1297 | __le32 request_id; | |
1298 | } __packed; | |
1299 | ||
1300 | /* Greybus Camera Metadata request payload - operation has no response */ | |
1301 | struct gb_camera_metadata_request { | |
1302 | __le32 request_id; | |
1303 | __le16 frame_number; | |
1304 | __u8 stream; | |
1305 | __u8 padding; | |
8e77c83e | 1306 | __u8 metadata[0]; |
e61a2a71 LP |
1307 | } __packed; |
1308 | ||
2870b52b RMS |
1309 | /* Lights */ |
1310 | ||
1311 | #define GB_LIGHTS_VERSION_MAJOR 0x00 | |
1312 | #define GB_LIGHTS_VERSION_MINOR 0x01 | |
1313 | ||
1314 | /* Greybus Lights request types */ | |
2870b52b RMS |
1315 | #define GB_LIGHTS_TYPE_GET_LIGHTS 0x02 |
1316 | #define GB_LIGHTS_TYPE_GET_LIGHT_CONFIG 0x03 | |
1317 | #define GB_LIGHTS_TYPE_GET_CHANNEL_CONFIG 0x04 | |
1318 | #define GB_LIGHTS_TYPE_GET_CHANNEL_FLASH_CONFIG 0x05 | |
1319 | #define GB_LIGHTS_TYPE_SET_BRIGHTNESS 0x06 | |
1320 | #define GB_LIGHTS_TYPE_SET_BLINK 0x07 | |
1321 | #define GB_LIGHTS_TYPE_SET_COLOR 0x08 | |
1322 | #define GB_LIGHTS_TYPE_SET_FADE 0x09 | |
1323 | #define GB_LIGHTS_TYPE_EVENT 0x0A | |
1324 | #define GB_LIGHTS_TYPE_SET_FLASH_INTENSITY 0x0B | |
1325 | #define GB_LIGHTS_TYPE_SET_FLASH_STROBE 0x0C | |
1326 | #define GB_LIGHTS_TYPE_SET_FLASH_TIMEOUT 0x0D | |
1327 | #define GB_LIGHTS_TYPE_GET_FLASH_FAULT 0x0E | |
1328 | ||
1329 | /* Greybus Light modes */ | |
1330 | ||
1331 | /* | |
1332 | * if you add any specific mode below, update also the | |
1333 | * GB_CHANNEL_MODE_DEFINED_RANGE value accordingly | |
1334 | */ | |
1335 | #define GB_CHANNEL_MODE_NONE 0x00000000 | |
1336 | #define GB_CHANNEL_MODE_BATTERY 0x00000001 | |
1337 | #define GB_CHANNEL_MODE_POWER 0x00000002 | |
1338 | #define GB_CHANNEL_MODE_WIRELESS 0x00000004 | |
1339 | #define GB_CHANNEL_MODE_BLUETOOTH 0x00000008 | |
1340 | #define GB_CHANNEL_MODE_KEYBOARD 0x00000010 | |
1341 | #define GB_CHANNEL_MODE_BUTTONS 0x00000020 | |
1342 | #define GB_CHANNEL_MODE_NOTIFICATION 0x00000040 | |
1343 | #define GB_CHANNEL_MODE_ATTENTION 0x00000080 | |
1344 | #define GB_CHANNEL_MODE_FLASH 0x00000100 | |
1345 | #define GB_CHANNEL_MODE_TORCH 0x00000200 | |
1346 | #define GB_CHANNEL_MODE_INDICATOR 0x00000400 | |
1347 | ||
1348 | /* Lights Mode valid bit values */ | |
1349 | #define GB_CHANNEL_MODE_DEFINED_RANGE 0x000004FF | |
1350 | #define GB_CHANNEL_MODE_VENDOR_RANGE 0x00F00000 | |
1351 | ||
1352 | /* Greybus Light Channels Flags */ | |
1353 | #define GB_LIGHT_CHANNEL_MULTICOLOR 0x00000001 | |
1354 | #define GB_LIGHT_CHANNEL_FADER 0x00000002 | |
1355 | #define GB_LIGHT_CHANNEL_BLINK 0x00000004 | |
1356 | ||
1357 | /* get count of lights in module */ | |
1358 | struct gb_lights_get_lights_response { | |
1359 | __u8 lights_count; | |
b701686a | 1360 | } __packed; |
2870b52b RMS |
1361 | |
1362 | /* light config request payload */ | |
1363 | struct gb_lights_get_light_config_request { | |
1364 | __u8 id; | |
b701686a | 1365 | } __packed; |
2870b52b RMS |
1366 | |
1367 | /* light config response payload */ | |
1368 | struct gb_lights_get_light_config_response { | |
1369 | __u8 channel_count; | |
1370 | __u8 name[32]; | |
b701686a | 1371 | } __packed; |
2870b52b RMS |
1372 | |
1373 | /* channel config request payload */ | |
1374 | struct gb_lights_get_channel_config_request { | |
1375 | __u8 light_id; | |
1376 | __u8 channel_id; | |
b701686a | 1377 | } __packed; |
2870b52b RMS |
1378 | |
1379 | /* channel flash config request payload */ | |
1380 | struct gb_lights_get_channel_flash_config_request { | |
1381 | __u8 light_id; | |
1382 | __u8 channel_id; | |
b701686a | 1383 | } __packed; |
2870b52b RMS |
1384 | |
1385 | /* channel config response payload */ | |
1386 | struct gb_lights_get_channel_config_response { | |
1387 | __u8 max_brightness; | |
1388 | __le32 flags; | |
1389 | __le32 color; | |
1390 | __u8 color_name[32]; | |
1391 | __le32 mode; | |
1392 | __u8 mode_name[32]; | |
1393 | } __packed; | |
1394 | ||
1395 | /* channel flash config response payload */ | |
1396 | struct gb_lights_get_channel_flash_config_response { | |
1397 | __le32 intensity_min_uA; | |
1398 | __le32 intensity_max_uA; | |
1399 | __le32 intensity_step_uA; | |
1400 | __le32 timeout_min_us; | |
1401 | __le32 timeout_max_us; | |
1402 | __le32 timeout_step_us; | |
b701686a | 1403 | } __packed; |
2870b52b RMS |
1404 | |
1405 | /* blink request payload: response have no payload */ | |
1406 | struct gb_lights_blink_request { | |
1407 | __u8 light_id; | |
1408 | __u8 channel_id; | |
1409 | __le16 time_on_ms; | |
1410 | __le16 time_off_ms; | |
b701686a | 1411 | } __packed; |
2870b52b RMS |
1412 | |
1413 | /* set brightness request payload: response have no payload */ | |
1414 | struct gb_lights_set_brightness_request { | |
1415 | __u8 light_id; | |
1416 | __u8 channel_id; | |
1417 | __u8 brightness; | |
b701686a | 1418 | } __packed; |
2870b52b RMS |
1419 | |
1420 | /* set color request payload: response have no payload */ | |
1421 | struct gb_lights_set_color_request { | |
1422 | __u8 light_id; | |
1423 | __u8 channel_id; | |
1424 | __le32 color; | |
1425 | } __packed; | |
1426 | ||
1427 | /* set fade request payload: response have no payload */ | |
1428 | struct gb_lights_set_fade_request { | |
1429 | __u8 light_id; | |
1430 | __u8 channel_id; | |
1431 | __u8 fade_in; | |
1432 | __u8 fade_out; | |
b701686a | 1433 | } __packed; |
2870b52b RMS |
1434 | |
1435 | /* event request: generated by module */ | |
1436 | struct gb_lights_event_request { | |
1437 | __u8 light_id; | |
1438 | __u8 event; | |
1439 | #define GB_LIGHTS_LIGHT_CONFIG 0x01 | |
b701686a | 1440 | } __packed; |
2870b52b RMS |
1441 | |
1442 | /* set flash intensity request payload: response have no payload */ | |
1443 | struct gb_lights_set_flash_intensity_request { | |
1444 | __u8 light_id; | |
1445 | __u8 channel_id; | |
1446 | __le32 intensity_uA; | |
1447 | } __packed; | |
1448 | ||
1449 | /* set flash strobe state request payload: response have no payload */ | |
1450 | struct gb_lights_set_flash_strobe_request { | |
1451 | __u8 light_id; | |
1452 | __u8 channel_id; | |
1453 | __u8 state; | |
b701686a | 1454 | } __packed; |
2870b52b RMS |
1455 | |
1456 | /* set flash timeout request payload: response have no payload */ | |
1457 | struct gb_lights_set_flash_timeout_request { | |
1458 | __u8 light_id; | |
1459 | __u8 channel_id; | |
1460 | __le32 timeout_us; | |
1461 | } __packed; | |
1462 | ||
1463 | /* get flash fault request payload */ | |
1464 | struct gb_lights_get_flash_fault_request { | |
1465 | __u8 light_id; | |
1466 | __u8 channel_id; | |
b701686a | 1467 | } __packed; |
2870b52b RMS |
1468 | |
1469 | /* get flash fault response payload */ | |
1470 | struct gb_lights_get_flash_fault_response { | |
1471 | __le32 fault; | |
1472 | #define GB_LIGHTS_FLASH_FAULT_OVER_VOLTAGE 0x00000000 | |
1473 | #define GB_LIGHTS_FLASH_FAULT_TIMEOUT 0x00000001 | |
1474 | #define GB_LIGHTS_FLASH_FAULT_OVER_TEMPERATURE 0x00000002 | |
1475 | #define GB_LIGHTS_FLASH_FAULT_SHORT_CIRCUIT 0x00000004 | |
1476 | #define GB_LIGHTS_FLASH_FAULT_OVER_CURRENT 0x00000008 | |
1477 | #define GB_LIGHTS_FLASH_FAULT_INDICATOR 0x00000010 | |
1478 | #define GB_LIGHTS_FLASH_FAULT_UNDER_VOLTAGE 0x00000020 | |
1479 | #define GB_LIGHTS_FLASH_FAULT_INPUT_VOLTAGE 0x00000040 | |
1480 | #define GB_LIGHTS_FLASH_FAULT_LED_OVER_TEMPERATURE 0x00000080 | |
b701686a | 1481 | } __packed; |
2870b52b | 1482 | |
ba4144af MG |
1483 | /* Audio */ |
1484 | ||
1485 | /* Version of the Greybus audio protocol we support */ | |
1486 | #define GB_AUDIO_VERSION_MAJOR 0x00 | |
1487 | #define GB_AUDIO_VERSION_MINOR 0x01 | |
1488 | ||
1489 | #define GB_AUDIO_TYPE_PROTOCOL_VERSION 0x01 | |
1490 | #define GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE 0x02 | |
1491 | #define GB_AUDIO_TYPE_GET_TOPOLOGY 0x03 | |
1492 | #define GB_AUDIO_TYPE_GET_CONTROL 0x04 | |
1493 | #define GB_AUDIO_TYPE_SET_CONTROL 0x05 | |
1494 | #define GB_AUDIO_TYPE_ENABLE_WIDGET 0x06 | |
1495 | #define GB_AUDIO_TYPE_DISABLE_WIDGET 0x07 | |
1496 | #define GB_AUDIO_TYPE_GET_PCM 0x08 | |
1497 | #define GB_AUDIO_TYPE_SET_PCM 0x09 | |
1498 | #define GB_AUDIO_TYPE_SET_TX_DATA_SIZE 0x0a | |
1499 | #define GB_AUDIO_TYPE_GET_TX_DELAY 0x0b | |
1500 | #define GB_AUDIO_TYPE_ACTIVATE_TX 0x0c | |
1501 | #define GB_AUDIO_TYPE_DEACTIVATE_TX 0x0d | |
1502 | #define GB_AUDIO_TYPE_SET_RX_DATA_SIZE 0x0e | |
1503 | #define GB_AUDIO_TYPE_GET_RX_DELAY 0x0f | |
1504 | #define GB_AUDIO_TYPE_ACTIVATE_RX 0x10 | |
1505 | #define GB_AUDIO_TYPE_DEACTIVATE_RX 0x11 | |
1506 | #define GB_AUDIO_TYPE_JACK_EVENT 0x12 | |
1507 | #define GB_AUDIO_TYPE_BUTTON_EVENT 0x13 | |
1508 | #define GB_AUDIO_TYPE_STREAMING_EVENT 0x14 | |
1509 | #define GB_AUDIO_TYPE_SEND_DATA 0x15 | |
1510 | ||
1511 | /* Module must be able to buffer 10ms of audio data, minimum */ | |
1512 | #define GB_AUDIO_SAMPLE_BUFFER_MIN_US 10000 | |
1513 | ||
1514 | #define GB_AUDIO_PCM_NAME_MAX 32 | |
1515 | #define AUDIO_DAI_NAME_MAX 32 | |
1516 | #define AUDIO_CONTROL_NAME_MAX 32 | |
1517 | #define AUDIO_CTL_ELEM_NAME_MAX 44 | |
1518 | #define AUDIO_ENUM_NAME_MAX 64 | |
1519 | #define AUDIO_WIDGET_NAME_MAX 32 | |
1520 | ||
1521 | /* See SNDRV_PCM_FMTBIT_* in Linux source */ | |
1522 | #define GB_AUDIO_PCM_FMT_S8 BIT(0) | |
1523 | #define GB_AUDIO_PCM_FMT_U8 BIT(1) | |
1524 | #define GB_AUDIO_PCM_FMT_S16_LE BIT(2) | |
1525 | #define GB_AUDIO_PCM_FMT_S16_BE BIT(3) | |
1526 | #define GB_AUDIO_PCM_FMT_U16_LE BIT(4) | |
1527 | #define GB_AUDIO_PCM_FMT_U16_BE BIT(5) | |
1528 | #define GB_AUDIO_PCM_FMT_S24_LE BIT(6) | |
1529 | #define GB_AUDIO_PCM_FMT_S24_BE BIT(7) | |
1530 | #define GB_AUDIO_PCM_FMT_U24_LE BIT(8) | |
1531 | #define GB_AUDIO_PCM_FMT_U24_BE BIT(9) | |
1532 | #define GB_AUDIO_PCM_FMT_S32_LE BIT(10) | |
1533 | #define GB_AUDIO_PCM_FMT_S32_BE BIT(11) | |
1534 | #define GB_AUDIO_PCM_FMT_U32_LE BIT(12) | |
1535 | #define GB_AUDIO_PCM_FMT_U32_BE BIT(13) | |
1536 | ||
1537 | /* See SNDRV_PCM_RATE_* in Linux source */ | |
1538 | #define GB_AUDIO_PCM_RATE_5512 BIT(0) | |
1539 | #define GB_AUDIO_PCM_RATE_8000 BIT(1) | |
1540 | #define GB_AUDIO_PCM_RATE_11025 BIT(2) | |
1541 | #define GB_AUDIO_PCM_RATE_16000 BIT(3) | |
1542 | #define GB_AUDIO_PCM_RATE_22050 BIT(4) | |
1543 | #define GB_AUDIO_PCM_RATE_32000 BIT(5) | |
1544 | #define GB_AUDIO_PCM_RATE_44100 BIT(6) | |
1545 | #define GB_AUDIO_PCM_RATE_48000 BIT(7) | |
1546 | #define GB_AUDIO_PCM_RATE_64000 BIT(8) | |
1547 | #define GB_AUDIO_PCM_RATE_88200 BIT(9) | |
1548 | #define GB_AUDIO_PCM_RATE_96000 BIT(10) | |
1549 | #define GB_AUDIO_PCM_RATE_176400 BIT(11) | |
1550 | #define GB_AUDIO_PCM_RATE_192000 BIT(12) | |
1551 | ||
1552 | #define GB_AUDIO_STREAM_TYPE_CAPTURE 0x1 | |
1553 | #define GB_AUDIO_STREAM_TYPE_PLAYBACK 0x2 | |
1554 | ||
1555 | #define GB_AUDIO_CTL_ELEM_ACCESS_READ BIT(0) | |
1556 | #define GB_AUDIO_CTL_ELEM_ACCESS_WRITE BIT(1) | |
1557 | ||
1558 | /* See SNDRV_CTL_ELEM_TYPE_* in Linux source */ | |
1559 | #define GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN 0x01 | |
1560 | #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER 0x02 | |
1561 | #define GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED 0x03 | |
1562 | #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER64 0x06 | |
1563 | ||
1564 | /* See SNDRV_CTL_ELEM_IFACE_* in Linux source */ | |
1565 | #define GB_AUDIO_CTL_ELEM_IFACE_CARD 0x00 | |
1566 | #define GB_AUDIO_CTL_ELEM_IFACE_HWDEP 0x01 | |
1567 | #define GB_AUDIO_CTL_ELEM_IFACE_MIXER 0x02 | |
1568 | #define GB_AUDIO_CTL_ELEM_IFACE_PCM 0x03 | |
1569 | #define GB_AUDIO_CTL_ELEM_IFACE_RAWMIDI 0x04 | |
1570 | #define GB_AUDIO_CTL_ELEM_IFACE_TIMER 0x05 | |
1571 | #define GB_AUDIO_CTL_ELEM_IFACE_SEQUENCER 0x06 | |
1572 | ||
1573 | /* SNDRV_CTL_ELEM_ACCESS_* in Linux source */ | |
1574 | #define GB_AUDIO_ACCESS_READ BIT(0) | |
1575 | #define GB_AUDIO_ACCESS_WRITE BIT(1) | |
1576 | #define GB_AUDIO_ACCESS_VOLATILE BIT(2) | |
1577 | #define GB_AUDIO_ACCESS_TIMESTAMP BIT(3) | |
1578 | #define GB_AUDIO_ACCESS_TLV_READ BIT(4) | |
1579 | #define GB_AUDIO_ACCESS_TLV_WRITE BIT(5) | |
1580 | #define GB_AUDIO_ACCESS_TLV_COMMAND BIT(6) | |
1581 | #define GB_AUDIO_ACCESS_INACTIVE BIT(7) | |
1582 | #define GB_AUDIO_ACCESS_LOCK BIT(8) | |
1583 | #define GB_AUDIO_ACCESS_OWNER BIT(9) | |
1584 | ||
1585 | /* enum snd_soc_dapm_type */ | |
1586 | #define GB_AUDIO_WIDGET_TYPE_INPUT 0x0 | |
1587 | #define GB_AUDIO_WIDGET_TYPE_OUTPUT 0x1 | |
1588 | #define GB_AUDIO_WIDGET_TYPE_MUX 0x2 | |
1589 | #define GB_AUDIO_WIDGET_TYPE_VIRT_MUX 0x3 | |
1590 | #define GB_AUDIO_WIDGET_TYPE_VALUE_MUX 0x4 | |
1591 | #define GB_AUDIO_WIDGET_TYPE_MIXER 0x5 | |
1592 | #define GB_AUDIO_WIDGET_TYPE_MIXER_NAMED_CTL 0x6 | |
1593 | #define GB_AUDIO_WIDGET_TYPE_PGA 0x7 | |
1594 | #define GB_AUDIO_WIDGET_TYPE_OUT_DRV 0x8 | |
1595 | #define GB_AUDIO_WIDGET_TYPE_ADC 0x9 | |
1596 | #define GB_AUDIO_WIDGET_TYPE_DAC 0xa | |
1597 | #define GB_AUDIO_WIDGET_TYPE_MICBIAS 0xb | |
1598 | #define GB_AUDIO_WIDGET_TYPE_MIC 0xc | |
1599 | #define GB_AUDIO_WIDGET_TYPE_HP 0xd | |
1600 | #define GB_AUDIO_WIDGET_TYPE_SPK 0xe | |
1601 | #define GB_AUDIO_WIDGET_TYPE_LINE 0xf | |
1602 | #define GB_AUDIO_WIDGET_TYPE_SWITCH 0x10 | |
1603 | #define GB_AUDIO_WIDGET_TYPE_VMID 0x11 | |
1604 | #define GB_AUDIO_WIDGET_TYPE_PRE 0x12 | |
1605 | #define GB_AUDIO_WIDGET_TYPE_POST 0x13 | |
1606 | #define GB_AUDIO_WIDGET_TYPE_SUPPLY 0x14 | |
1607 | #define GB_AUDIO_WIDGET_TYPE_REGULATOR_SUPPLY 0x15 | |
1608 | #define GB_AUDIO_WIDGET_TYPE_CLOCK_SUPPLY 0x16 | |
1609 | #define GB_AUDIO_WIDGET_TYPE_AIF_IN 0x17 | |
1610 | #define GB_AUDIO_WIDGET_TYPE_AIF_OUT 0x18 | |
1611 | #define GB_AUDIO_WIDGET_TYPE_SIGGEN 0x19 | |
1612 | #define GB_AUDIO_WIDGET_TYPE_DAI_IN 0x1a | |
1613 | #define GB_AUDIO_WIDGET_TYPE_DAI_OUT 0x1b | |
1614 | #define GB_AUDIO_WIDGET_TYPE_DAI_LINK 0x1c | |
1615 | ||
1616 | #define GB_AUDIO_WIDGET_STATE_DISABLED 0x01 | |
1617 | #define GB_AUDIO_WIDGET_STATE_ENAABLED 0x02 | |
1618 | ||
1619 | #define GB_AUDIO_JACK_EVENT_INSERTION 0x1 | |
1620 | #define GB_AUDIO_JACK_EVENT_REMOVAL 0x2 | |
1621 | ||
1622 | #define GB_AUDIO_BUTTON_EVENT_PRESS 0x1 | |
1623 | #define GB_AUDIO_BUTTON_EVENT_RELEASE 0x2 | |
1624 | ||
1625 | #define GB_AUDIO_STREAMING_EVENT_UNSPECIFIED 0x1 | |
1626 | #define GB_AUDIO_STREAMING_EVENT_HALT 0x2 | |
1627 | #define GB_AUDIO_STREAMING_EVENT_INTERNAL_ERROR 0x3 | |
1628 | #define GB_AUDIO_STREAMING_EVENT_PROTOCOL_ERROR 0x4 | |
1629 | #define GB_AUDIO_STREAMING_EVENT_FAILURE 0x5 | |
1630 | #define GB_AUDIO_STREAMING_EVENT_UNDERRUN 0x6 | |
1631 | #define GB_AUDIO_STREAMING_EVENT_OVERRUN 0x7 | |
1632 | #define GB_AUDIO_STREAMING_EVENT_CLOCKING 0x8 | |
1633 | #define GB_AUDIO_STREAMING_EVENT_DATA_LEN 0x9 | |
1634 | ||
1635 | #define GB_AUDIO_INVALID_INDEX 0xff | |
1636 | ||
1637 | struct gb_audio_pcm { | |
1638 | __u8 stream_name[GB_AUDIO_PCM_NAME_MAX]; | |
1639 | __le32 formats; /* GB_AUDIO_PCM_FMT_* */ | |
1640 | __le32 rates; /* GB_AUDIO_PCM_RATE_* */ | |
1641 | __u8 chan_min; | |
1642 | __u8 chan_max; | |
1643 | __u8 sig_bits; /* number of bits of content */ | |
1644 | } __packed; | |
1645 | ||
1646 | struct gb_audio_dai { | |
1647 | __u8 name[AUDIO_DAI_NAME_MAX]; | |
1648 | __le16 data_cport; | |
1649 | struct gb_audio_pcm capture; | |
1650 | struct gb_audio_pcm playback; | |
1651 | } __packed; | |
1652 | ||
1653 | struct gb_audio_integer { | |
1654 | __le32 min; | |
1655 | __le32 max; | |
1656 | __le32 step; | |
1657 | } __packed; | |
1658 | ||
1659 | struct gb_audio_integer64 { | |
1660 | __le64 min; | |
1661 | __le64 max; | |
1662 | __le64 step; | |
1663 | } __packed; | |
1664 | ||
1665 | struct gb_audio_enumerated { | |
1666 | __le32 items; | |
1667 | __le16 names_length; | |
1668 | __u8 names[0]; | |
1669 | } __packed; | |
1670 | ||
1671 | struct gb_audio_ctl_elem_info { /* See snd_ctl_elem_info in Linux source */ | |
1672 | __u8 type; /* GB_AUDIO_CTL_ELEM_TYPE_* */ | |
1673 | __le16 dimen[4]; | |
1674 | union { | |
1675 | struct gb_audio_integer integer; | |
1676 | struct gb_audio_integer64 integer64; | |
1677 | struct gb_audio_enumerated enumerated; | |
1678 | } value; | |
1679 | } __packed; | |
1680 | ||
1681 | struct gb_audio_ctl_elem_value { /* See snd_ctl_elem_value in Linux source */ | |
1682 | __le64 timestamp; /* XXX needed? */ | |
1683 | union { | |
1684 | __le32 integer_value[2]; /* consider CTL_DOUBLE_xxx */ | |
1685 | __le64 integer64_value[2]; | |
1686 | __le32 enumerated_item[2]; | |
1687 | } value; | |
1688 | } __packed; | |
1689 | ||
1690 | struct gb_audio_control { | |
1691 | __u8 name[AUDIO_CONTROL_NAME_MAX]; | |
1692 | __u8 id; /* 0-63 */ | |
1693 | __u8 iface; /* GB_AUDIO_IFACE_* */ | |
1694 | __le16 data_cport; | |
1695 | __le32 access; /* GB_AUDIO_ACCESS_* */ | |
1696 | __u8 count; /* count of same elements */ | |
1697 | __u8 count_values; /* count of values, max=2 for CTL_DOUBLE_xxx */ | |
1698 | struct gb_audio_ctl_elem_info info; | |
1699 | } __packed; | |
1700 | ||
1701 | struct gb_audio_widget { | |
1702 | __u8 name[AUDIO_WIDGET_NAME_MAX]; | |
1703 | __u8 sname[AUDIO_WIDGET_NAME_MAX]; | |
1704 | __u8 id; | |
1705 | __u8 type; /* GB_AUDIO_WIDGET_TYPE_* */ | |
1706 | __u8 state; /* GB_AUDIO_WIDGET_STATE_* */ | |
1707 | __u8 ncontrols; | |
1708 | struct gb_audio_control ctl[0]; /* 'ncontrols' entries */ | |
1709 | } __packed; | |
1710 | ||
1711 | struct gb_audio_route { | |
1712 | __u8 source_id; /* widget id */ | |
1713 | __u8 destination_id; /* widget id */ | |
1714 | __u8 control_id; /* 0-63 */ | |
1715 | __u8 index; /* Selection within the control */ | |
1716 | } __packed; | |
1717 | ||
1718 | struct gb_audio_topology { | |
1719 | __u8 num_dais; | |
1720 | __u8 num_controls; | |
1721 | __u8 num_widgets; | |
1722 | __u8 num_routes; | |
1723 | __u32 size_dais; | |
1724 | __u32 size_controls; | |
1725 | __u32 size_widgets; | |
1726 | __u32 size_routes; | |
1727 | /* | |
1728 | * struct gb_audio_dai dai[num_dais]; | |
1729 | * struct gb_audio_control controls[num_controls]; | |
1730 | * struct gb_audio_widget widgets[num_widgets]; | |
1731 | * struct gb_audio_route routes[num_routes]; | |
1732 | */ | |
1733 | __u8 data[0]; | |
1734 | } __packed; | |
1735 | ||
1736 | struct gb_audio_get_topology_size_response { | |
1737 | __le16 size; | |
1738 | } __packed; | |
1739 | ||
1740 | struct gb_audio_get_topology_response { | |
1741 | struct gb_audio_topology topology; | |
1742 | } __packed; | |
1743 | ||
1744 | struct gb_audio_get_control_request { | |
1745 | __u8 control_id; | |
1746 | __u8 index; | |
1747 | } __packed; | |
1748 | ||
1749 | struct gb_audio_get_control_response { | |
1750 | struct gb_audio_ctl_elem_value value; | |
1751 | } __packed; | |
1752 | ||
1753 | struct gb_audio_set_control_request { | |
1754 | __u8 control_id; | |
1755 | __u8 index; | |
1756 | struct gb_audio_ctl_elem_value value; | |
1757 | } __packed; | |
1758 | ||
1759 | struct gb_audio_enable_widget_request { | |
1760 | __u8 widget_id; | |
1761 | } __packed; | |
1762 | ||
1763 | struct gb_audio_disable_widget_request { | |
1764 | __u8 widget_id; | |
1765 | } __packed; | |
1766 | ||
1767 | struct gb_audio_get_pcm_request { | |
1768 | __le16 data_cport; | |
1769 | } __packed; | |
1770 | ||
1771 | struct gb_audio_get_pcm_response { | |
1772 | __le32 format; | |
1773 | __le32 rate; | |
1774 | __u8 channels; | |
1775 | __u8 sig_bits; | |
1776 | } __packed; | |
1777 | ||
1778 | struct gb_audio_set_pcm_request { | |
1779 | __le16 data_cport; | |
1780 | __le32 format; | |
1781 | __le32 rate; | |
1782 | __u8 channels; | |
1783 | __u8 sig_bits; | |
1784 | } __packed; | |
1785 | ||
1786 | struct gb_audio_set_tx_data_size_request { | |
1787 | __le16 data_cport; | |
1788 | __le16 size; | |
1789 | } __packed; | |
1790 | ||
1791 | struct gb_audio_get_tx_delay_request { | |
1792 | __le16 data_cport; | |
1793 | } __packed; | |
1794 | ||
1795 | struct gb_audio_get_tx_delay_response { | |
1796 | __le32 delay; | |
1797 | } __packed; | |
1798 | ||
1799 | struct gb_audio_activate_tx_request { | |
1800 | __le16 data_cport; | |
1801 | } __packed; | |
1802 | ||
1803 | struct gb_audio_deactivate_tx_request { | |
1804 | __le16 data_cport; | |
1805 | } __packed; | |
1806 | ||
1807 | struct gb_audio_set_rx_data_size_request { | |
1808 | __le16 data_cport; | |
1809 | __le16 size; | |
1810 | } __packed; | |
1811 | ||
1812 | struct gb_audio_get_rx_delay_request { | |
1813 | __le16 data_cport; | |
1814 | } __packed; | |
1815 | ||
1816 | struct gb_audio_get_rx_delay_response { | |
1817 | __le32 delay; | |
1818 | } __packed; | |
1819 | ||
1820 | struct gb_audio_activate_rx_request { | |
1821 | __le16 data_cport; | |
1822 | } __packed; | |
1823 | ||
1824 | struct gb_audio_deactivate_rx_request { | |
1825 | __le16 data_cport; | |
1826 | } __packed; | |
1827 | ||
1828 | struct gb_audio_jack_event_request { | |
1829 | __u8 widget_id; | |
1830 | __u8 widget_type; | |
1831 | __u8 event; | |
1832 | } __packed; | |
1833 | ||
1834 | struct gb_audio_button_event_request { | |
1835 | __u8 widget_id; | |
1836 | __u8 button_id; | |
1837 | __u8 event; | |
1838 | } __packed; | |
1839 | ||
1840 | struct gb_audio_streaming_event_request { | |
1841 | __le16 data_cport; | |
1842 | __u8 event; | |
1843 | } __packed; | |
1844 | ||
1845 | struct gb_audio_send_data_request { | |
1846 | __le64 timestamp; | |
1847 | __u8 data[0]; | |
1848 | } __packed; | |
1849 | ||
012d7d4f | 1850 | #endif /* __GREYBUS_PROTOCOLS_H */ |
4ef53485 | 1851 |