greybus: greybus_protocols.h/es2: Ensure __le32 is used not u32
[linux-2.6/btrfs-unstable.git] / drivers / staging / greybus / greybus_protocols.h
blobd39a580a3a55a392e341929227046361fa40476b
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.
5 * GPL LICENSE SUMMARY
7 * Copyright(c) 2014 - 2015 Google Inc. All rights reserved.
8 * Copyright(c) 2014 - 2015 Linaro Ltd. All rights reserved.
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.
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.
19 * BSD LICENSE
21 * Copyright(c) 2014 - 2015 Google Inc. All rights reserved.
22 * Copyright(c) 2014 - 2015 Linaro Ltd. All rights reserved.
24 * Redistribution and use in source and binary forms, with or without
25 * modification, are permitted provided that the following conditions
26 * are met:
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.
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.
52 #ifndef __GREYBUS_PROTOCOLS_H
53 #define __GREYBUS_PROTOCOLS_H
55 /* Fixed IDs for control/svc protocols */
57 /* SVC switch-port device ids */
58 #define GB_SVC_DEVICE_ID_SVC 0
59 #define GB_SVC_DEVICE_ID_AP 1
60 #define GB_SVC_DEVICE_ID_MIN 2
61 #define GB_SVC_DEVICE_ID_MAX 31
63 #define GB_SVC_CPORT_ID 0
64 #define GB_CONTROL_BUNDLE_ID 0
65 #define GB_CONTROL_CPORT_ID 0
69 * All operation messages (both requests and responses) begin with
70 * a header that encodes the size of the message (header included).
71 * This header also contains a unique identifier, that associates a
72 * response message with its operation. The header contains an
73 * operation type field, whose interpretation is dependent on what
74 * type of protocol is used over the connection. The high bit
75 * (0x80) of the operation type field is used to indicate whether
76 * the message is a request (clear) or a response (set).
78 * Response messages include an additional result byte, which
79 * communicates the result of the corresponding request. A zero
80 * result value means the operation completed successfully. Any
81 * other value indicates an error; in this case, the payload of the
82 * response message (if any) is ignored. The result byte must be
83 * zero in the header for a request message.
85 * The wire format for all numeric fields in the header is little
86 * endian. Any operation-specific data begins immediately after the
87 * header.
89 struct gb_operation_msg_hdr {
90 __le16 size; /* Size in bytes of header + payload */
91 __le16 operation_id; /* Operation unique id */
92 __u8 type; /* E.g GB_I2C_TYPE_* or GB_GPIO_TYPE_* */
93 __u8 result; /* Result of request (in responses only) */
94 __u8 pad[2]; /* must be zero (ignore when read) */
95 } __packed;
98 /* Generic request types */
99 #define GB_REQUEST_TYPE_PING 0x00
100 #define GB_REQUEST_TYPE_INVALID 0x7f
102 struct gb_protocol_version_request {
103 __u8 major;
104 __u8 minor;
105 } __packed;
107 struct gb_protocol_version_response {
108 __u8 major;
109 __u8 minor;
110 } __packed;
112 /* Control Protocol */
114 /* Greybus control request types */
115 #define GB_CONTROL_TYPE_VERSION 0x01
116 #define GB_CONTROL_TYPE_PROBE_AP 0x02
117 #define GB_CONTROL_TYPE_GET_MANIFEST_SIZE 0x03
118 #define GB_CONTROL_TYPE_GET_MANIFEST 0x04
119 #define GB_CONTROL_TYPE_CONNECTED 0x05
120 #define GB_CONTROL_TYPE_DISCONNECTED 0x06
121 #define GB_CONTROL_TYPE_TIMESYNC_ENABLE 0x07
122 #define GB_CONTROL_TYPE_TIMESYNC_DISABLE 0x08
123 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
124 /* Unused 0x0a */
125 #define GB_CONTROL_TYPE_BUNDLE_VERSION 0x0b
126 #define GB_CONTROL_TYPE_DISCONNECTING 0x0c
127 #define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT 0x0d
128 #define GB_CONTROL_TYPE_MODE_SWITCH 0x0e
129 #define GB_CONTROL_TYPE_BUNDLE_SUSPEND 0x0f
130 #define GB_CONTROL_TYPE_BUNDLE_RESUME 0x10
131 #define GB_CONTROL_TYPE_BUNDLE_DEACTIVATE 0x11
132 #define GB_CONTROL_TYPE_BUNDLE_ACTIVATE 0x12
133 #define GB_CONTROL_TYPE_INTF_SUSPEND_PREPARE 0x13
134 #define GB_CONTROL_TYPE_INTF_DEACTIVATE_PREPARE 0x14
135 #define GB_CONTROL_TYPE_INTF_HIBERNATE_ABORT 0x15
137 struct gb_control_version_request {
138 __u8 major;
139 __u8 minor;
140 } __packed;
142 struct gb_control_version_response {
143 __u8 major;
144 __u8 minor;
145 } __packed;
147 struct gb_control_bundle_version_request {
148 __u8 bundle_id;
149 } __packed;
151 struct gb_control_bundle_version_response {
152 __u8 major;
153 __u8 minor;
154 } __packed;
156 /* Control protocol manifest get size request has no payload*/
157 struct gb_control_get_manifest_size_response {
158 __le16 size;
159 } __packed;
161 /* Control protocol manifest get request has no payload */
162 struct gb_control_get_manifest_response {
163 __u8 data[0];
164 } __packed;
166 /* Control protocol [dis]connected request */
167 struct gb_control_connected_request {
168 __le16 cport_id;
169 } __packed;
171 struct gb_control_disconnecting_request {
172 __le16 cport_id;
173 } __packed;
174 /* disconnecting response has no payload */
176 struct gb_control_disconnected_request {
177 __le16 cport_id;
178 } __packed;
179 /* Control protocol [dis]connected response has no payload */
181 #define GB_TIMESYNC_MAX_STROBES 0x04
183 struct gb_control_timesync_enable_request {
184 __u8 count;
185 __le64 frame_time;
186 __le32 strobe_delay;
187 __le32 refclk;
188 } __packed;
189 /* timesync enable response has no payload */
191 struct gb_control_timesync_authoritative_request {
192 __le64 frame_time[GB_TIMESYNC_MAX_STROBES];
193 } __packed;
194 /* timesync authoritative response has no payload */
196 /* timesync get_last_event_request has no payload */
197 struct gb_control_timesync_get_last_event_response {
198 __le64 frame_time;
199 } __packed;
202 * All Bundle power management operations use the same request and response
203 * layout and status codes.
206 #define GB_CONTROL_BUNDLE_PM_OK 0x00
207 #define GB_CONTROL_BUNDLE_PM_INVAL 0x01
208 #define GB_CONTROL_BUNDLE_PM_BUSY 0x02
209 #define GB_CONTROL_BUNDLE_PM_FAIL 0x03
210 #define GB_CONTROL_BUNDLE_PM_NA 0x04
212 struct gb_control_bundle_pm_request {
213 __u8 bundle_id;
214 } __packed;
216 struct gb_control_bundle_pm_response {
217 __u8 status;
218 } __packed;
221 * Interface Suspend Prepare and Deactivate Prepare operations use the same
222 * response layout and error codes. Define a single response structure and reuse
223 * it. Both operations have no payload.
226 #define GB_CONTROL_INTF_PM_OK 0x00
227 #define GB_CONTROL_INTF_PM_BUSY 0x01
228 #define GB_CONTROL_INTF_PM_NA 0x02
230 struct gb_control_intf_pm_response {
231 __u8 status;
232 } __packed;
234 /* APBridge protocol */
236 /* request APB1 log */
237 #define GB_APB_REQUEST_LOG 0x02
239 /* request to map a cport to bulk in and bulk out endpoints */
240 #define GB_APB_REQUEST_EP_MAPPING 0x03
242 /* request to get the number of cports available */
243 #define GB_APB_REQUEST_CPORT_COUNT 0x04
245 /* request to reset a cport state */
246 #define GB_APB_REQUEST_RESET_CPORT 0x05
248 /* request to time the latency of messages on a given cport */
249 #define GB_APB_REQUEST_LATENCY_TAG_EN 0x06
250 #define GB_APB_REQUEST_LATENCY_TAG_DIS 0x07
252 /* request to control the CSI transmitter */
253 #define GB_APB_REQUEST_CSI_TX_CONTROL 0x08
255 /* request to control the CSI transmitter */
256 #define GB_APB_REQUEST_AUDIO_CONTROL 0x09
258 /* vendor requests to enable/disable CPort features */
259 #define GB_APB_REQUEST_CPORT_FEAT_EN 0x0b
260 #define GB_APB_REQUEST_CPORT_FEAT_DIS 0x0c
262 /* TimeSync commands */
263 #define REQUEST_TIMESYNC_ENABLE 0x0d
264 #define REQUEST_TIMESYNC_DISABLE 0x0e
265 #define REQUEST_TIMESYNC_AUTHORITATIVE 0x0f
266 #define REQUEST_TIMESYNC_GET_LAST_EVENT 0x10
268 /* requests to set Greybus CPort flags */
269 #define GB_APB_REQUEST_CPORT_FLAGS 0x11
271 /* ARPC command */
272 #define APBA_REQUEST_ARPC_RUN 0x12
274 struct gb_apb_request_cport_flags {
275 __le32 flags;
276 #define GB_APB_CPORT_FLAG_CONTROL 0x01
277 #define GB_APB_CPORT_FLAG_HIGH_PRIO 0x02
278 } __packed;
280 /* APBridgeA RPC (ARPC) */
282 enum arpc_result {
283 ARPC_SUCCESS = 0x00,
284 ARPC_NO_MEMORY = 0x01,
285 ARPC_INVALID = 0x02,
286 ARPC_TIMEOUT = 0x03,
287 ARPC_UNKNOWN_ERROR = 0xff,
290 /* ARPC request */
291 struct arpc_request_message {
292 __le16 id; /* RPC unique id */
293 __le16 size; /* Size in bytes of header + payload */
294 __u8 type; /* RPC type */
295 __u8 data[0]; /* ARPC data */
296 } __packed;
298 /* ARPC response */
299 struct arpc_response_message {
300 __le16 id; /* RPC unique id */
301 __u8 result; /* Result of RPC */
302 } __packed;
304 #define ARPC_CPORT_RESET 0x00
306 struct arpc_cport_reset {
307 __le16 cport_id;
308 } __packed;
310 /* Firmware Download Protocol */
312 /* Request Types */
313 #define GB_FW_DOWNLOAD_TYPE_FIND_FIRMWARE 0x01
314 #define GB_FW_DOWNLOAD_TYPE_FETCH_FIRMWARE 0x02
315 #define GB_FW_DOWNLOAD_TYPE_RELEASE_FIRMWARE 0x03
317 #define GB_FIRMWARE_TAG_MAX_LEN 10
319 /* firmware download find firmware request/response */
320 struct gb_fw_download_find_firmware_request {
321 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
322 } __packed;
324 struct gb_fw_download_find_firmware_response {
325 __u8 firmware_id;
326 __le32 size;
327 } __packed;
329 /* firmware download fetch firmware request/response */
330 struct gb_fw_download_fetch_firmware_request {
331 __u8 firmware_id;
332 __le32 offset;
333 __le32 size;
334 } __packed;
336 struct gb_fw_download_fetch_firmware_response {
337 __u8 data[0];
338 } __packed;
340 /* firmware download release firmware request */
341 struct gb_fw_download_release_firmware_request {
342 __u8 firmware_id;
343 } __packed;
344 /* firmware download release firmware response has no payload */
347 /* Firmware Management Protocol */
349 /* Request Types */
350 #define GB_FW_MGMT_TYPE_INTERFACE_FW_VERSION 0x01
351 #define GB_FW_MGMT_TYPE_LOAD_AND_VALIDATE_FW 0x02
352 #define GB_FW_MGMT_TYPE_LOADED_FW 0x03
353 #define GB_FW_MGMT_TYPE_BACKEND_FW_VERSION 0x04
354 #define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATE 0x05
355 #define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATED 0x06
357 #define GB_FW_LOAD_METHOD_UNIPRO 0x01
358 #define GB_FW_LOAD_METHOD_INTERNAL 0x02
360 #define GB_FW_LOAD_STATUS_FAILED 0x00
361 #define GB_FW_LOAD_STATUS_UNVALIDATED 0x01
362 #define GB_FW_LOAD_STATUS_VALIDATED 0x02
363 #define GB_FW_LOAD_STATUS_VALIDATION_FAILED 0x03
365 #define GB_FW_BACKEND_FW_STATUS_SUCCESS 0x01
366 #define GB_FW_BACKEND_FW_STATUS_FAIL_FIND 0x02
367 #define GB_FW_BACKEND_FW_STATUS_FAIL_FETCH 0x03
368 #define GB_FW_BACKEND_FW_STATUS_FAIL_WRITE 0x04
369 #define GB_FW_BACKEND_FW_STATUS_INT 0x05
371 /* firmware management interface firmware version request has no payload */
372 struct gb_fw_mgmt_interface_fw_version_response {
373 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
374 __le16 major;
375 __le16 minor;
376 } __packed;
378 /* firmware management load and validate firmware request/response */
379 struct gb_fw_mgmt_load_and_validate_fw_request {
380 __u8 request_id;
381 __u8 load_method;
382 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
383 } __packed;
384 /* firmware management load and validate firmware response has no payload*/
386 /* firmware management loaded firmware request */
387 struct gb_fw_mgmt_loaded_fw_request {
388 __u8 request_id;
389 __u8 status;
390 __le16 major;
391 __le16 minor;
392 } __packed;
393 /* firmware management loaded firmware response has no payload */
395 /* firmware management backend firmware version request/response */
396 struct gb_fw_mgmt_backend_fw_version_request {
397 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
398 } __packed;
400 struct gb_fw_mgmt_backend_fw_version_response {
401 __le16 major;
402 __le16 minor;
403 } __packed;
405 /* firmware management backend firmware update request */
406 struct gb_fw_mgmt_backend_fw_update_request {
407 __u8 request_id;
408 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
409 } __packed;
410 /* firmware management backend firmware update response has no payload */
412 /* firmware management backend firmware updated request */
413 struct gb_fw_mgmt_backend_fw_updated_request {
414 __u8 request_id;
415 __u8 status;
416 } __packed;
417 /* firmware management backend firmware updated response has no payload */
420 /* Component Authentication Protocol (CAP) */
422 /* Request Types */
423 #define GB_CAP_TYPE_GET_ENDPOINT_UID 0x01
424 #define GB_CAP_TYPE_GET_IMS_CERTIFICATE 0x02
425 #define GB_CAP_TYPE_AUTHENTICATE 0x03
427 /* CAP get endpoint uid request has no payload */
428 struct gb_cap_get_endpoint_uid_response {
429 __u8 uid[8];
430 } __packed;
432 /* CAP get endpoint ims certificate request/response */
433 struct gb_cap_get_ims_certificate_request {
434 __le32 certificate_class;
435 __le32 certificate_id;
436 } __packed;
438 struct gb_cap_get_ims_certificate_response {
439 __u8 result_code;
440 __u8 certificate[0];
441 } __packed;
443 /* CAP authenticate request/response */
444 struct gb_cap_authenticate_request {
445 __le32 auth_type;
446 __u8 uid[8];
447 __u8 challenge[32];
448 } __packed;
450 struct gb_cap_authenticate_response {
451 __u8 result_code;
452 __u8 response[64];
453 __u8 signature[0];
454 } __packed;
457 /* Bootrom Protocol */
459 /* Version of the Greybus bootrom protocol we support */
460 #define GB_BOOTROM_VERSION_MAJOR 0x00
461 #define GB_BOOTROM_VERSION_MINOR 0x01
463 /* Greybus bootrom request types */
464 #define GB_BOOTROM_TYPE_VERSION 0x01
465 #define GB_BOOTROM_TYPE_FIRMWARE_SIZE 0x02
466 #define GB_BOOTROM_TYPE_GET_FIRMWARE 0x03
467 #define GB_BOOTROM_TYPE_READY_TO_BOOT 0x04
468 #define GB_BOOTROM_TYPE_AP_READY 0x05 /* Request with no-payload */
469 #define GB_BOOTROM_TYPE_GET_VID_PID 0x06 /* Request with no-payload */
471 /* Greybus bootrom boot stages */
472 #define GB_BOOTROM_BOOT_STAGE_ONE 0x01 /* Reserved for the boot ROM */
473 #define GB_BOOTROM_BOOT_STAGE_TWO 0x02 /* Bootrom package to be loaded by the boot ROM */
474 #define GB_BOOTROM_BOOT_STAGE_THREE 0x03 /* Module personality package loaded by Stage 2 firmware */
476 /* Greybus bootrom ready to boot status */
477 #define GB_BOOTROM_BOOT_STATUS_INVALID 0x00 /* Firmware blob could not be validated */
478 #define GB_BOOTROM_BOOT_STATUS_INSECURE 0x01 /* Firmware blob is valid but insecure */
479 #define GB_BOOTROM_BOOT_STATUS_SECURE 0x02 /* Firmware blob is valid and secure */
481 /* Max bootrom data fetch size in bytes */
482 #define GB_BOOTROM_FETCH_MAX 2000
484 struct gb_bootrom_version_request {
485 __u8 major;
486 __u8 minor;
487 } __packed;
489 struct gb_bootrom_version_response {
490 __u8 major;
491 __u8 minor;
492 } __packed;
494 /* Bootrom protocol firmware size request/response */
495 struct gb_bootrom_firmware_size_request {
496 __u8 stage;
497 } __packed;
499 struct gb_bootrom_firmware_size_response {
500 __le32 size;
501 } __packed;
503 /* Bootrom protocol get firmware request/response */
504 struct gb_bootrom_get_firmware_request {
505 __le32 offset;
506 __le32 size;
507 } __packed;
509 struct gb_bootrom_get_firmware_response {
510 __u8 data[0];
511 } __packed;
513 /* Bootrom protocol Ready to boot request */
514 struct gb_bootrom_ready_to_boot_request {
515 __u8 status;
516 } __packed;
517 /* Bootrom protocol Ready to boot response has no payload */
519 /* Bootrom protocol get VID/PID request has no payload */
520 struct gb_bootrom_get_vid_pid_response {
521 __le32 vendor_id;
522 __le32 product_id;
523 } __packed;
526 /* Power Supply */
528 /* Greybus power supply request types */
529 #define GB_POWER_SUPPLY_TYPE_GET_SUPPLIES 0x02
530 #define GB_POWER_SUPPLY_TYPE_GET_DESCRIPTION 0x03
531 #define GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS 0x04
532 #define GB_POWER_SUPPLY_TYPE_GET_PROPERTY 0x05
533 #define GB_POWER_SUPPLY_TYPE_SET_PROPERTY 0x06
534 #define GB_POWER_SUPPLY_TYPE_EVENT 0x07
536 /* Greybus power supply battery technologies types */
537 #define GB_POWER_SUPPLY_TECH_UNKNOWN 0x0000
538 #define GB_POWER_SUPPLY_TECH_NiMH 0x0001
539 #define GB_POWER_SUPPLY_TECH_LION 0x0002
540 #define GB_POWER_SUPPLY_TECH_LIPO 0x0003
541 #define GB_POWER_SUPPLY_TECH_LiFe 0x0004
542 #define GB_POWER_SUPPLY_TECH_NiCd 0x0005
543 #define GB_POWER_SUPPLY_TECH_LiMn 0x0006
545 /* Greybus power supply types */
546 #define GB_POWER_SUPPLY_UNKNOWN_TYPE 0x0000
547 #define GB_POWER_SUPPLY_BATTERY_TYPE 0x0001
548 #define GB_POWER_SUPPLY_UPS_TYPE 0x0002
549 #define GB_POWER_SUPPLY_MAINS_TYPE 0x0003
550 #define GB_POWER_SUPPLY_USB_TYPE 0x0004
551 #define GB_POWER_SUPPLY_USB_DCP_TYPE 0x0005
552 #define GB_POWER_SUPPLY_USB_CDP_TYPE 0x0006
553 #define GB_POWER_SUPPLY_USB_ACA_TYPE 0x0007
555 /* Greybus power supply health values */
556 #define GB_POWER_SUPPLY_HEALTH_UNKNOWN 0x0000
557 #define GB_POWER_SUPPLY_HEALTH_GOOD 0x0001
558 #define GB_POWER_SUPPLY_HEALTH_OVERHEAT 0x0002
559 #define GB_POWER_SUPPLY_HEALTH_DEAD 0x0003
560 #define GB_POWER_SUPPLY_HEALTH_OVERVOLTAGE 0x0004
561 #define GB_POWER_SUPPLY_HEALTH_UNSPEC_FAILURE 0x0005
562 #define GB_POWER_SUPPLY_HEALTH_COLD 0x0006
563 #define GB_POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE 0x0007
564 #define GB_POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE 0x0008
566 /* Greybus power supply status values */
567 #define GB_POWER_SUPPLY_STATUS_UNKNOWN 0x0000
568 #define GB_POWER_SUPPLY_STATUS_CHARGING 0x0001
569 #define GB_POWER_SUPPLY_STATUS_DISCHARGING 0x0002
570 #define GB_POWER_SUPPLY_STATUS_NOT_CHARGING 0x0003
571 #define GB_POWER_SUPPLY_STATUS_FULL 0x0004
573 /* Greybus power supply capacity level values */
574 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN 0x0000
575 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL 0x0001
576 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_LOW 0x0002
577 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL 0x0003
578 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_HIGH 0x0004
579 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_FULL 0x0005
581 /* Greybus power supply scope values */
582 #define GB_POWER_SUPPLY_SCOPE_UNKNOWN 0x0000
583 #define GB_POWER_SUPPLY_SCOPE_SYSTEM 0x0001
584 #define GB_POWER_SUPPLY_SCOPE_DEVICE 0x0002
586 struct gb_power_supply_get_supplies_response {
587 __u8 supplies_count;
588 } __packed;
590 struct gb_power_supply_get_description_request {
591 __u8 psy_id;
592 } __packed;
594 struct gb_power_supply_get_description_response {
595 __u8 manufacturer[32];
596 __u8 model[32];
597 __u8 serial_number[32];
598 __le16 type;
599 __u8 properties_count;
600 } __packed;
602 struct gb_power_supply_props_desc {
603 __u8 property;
604 #define GB_POWER_SUPPLY_PROP_STATUS 0x00
605 #define GB_POWER_SUPPLY_PROP_CHARGE_TYPE 0x01
606 #define GB_POWER_SUPPLY_PROP_HEALTH 0x02
607 #define GB_POWER_SUPPLY_PROP_PRESENT 0x03
608 #define GB_POWER_SUPPLY_PROP_ONLINE 0x04
609 #define GB_POWER_SUPPLY_PROP_AUTHENTIC 0x05
610 #define GB_POWER_SUPPLY_PROP_TECHNOLOGY 0x06
611 #define GB_POWER_SUPPLY_PROP_CYCLE_COUNT 0x07
612 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX 0x08
613 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN 0x09
614 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN 0x0A
615 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN 0x0B
616 #define GB_POWER_SUPPLY_PROP_VOLTAGE_NOW 0x0C
617 #define GB_POWER_SUPPLY_PROP_VOLTAGE_AVG 0x0D
618 #define GB_POWER_SUPPLY_PROP_VOLTAGE_OCV 0x0E
619 #define GB_POWER_SUPPLY_PROP_VOLTAGE_BOOT 0x0F
620 #define GB_POWER_SUPPLY_PROP_CURRENT_MAX 0x10
621 #define GB_POWER_SUPPLY_PROP_CURRENT_NOW 0x11
622 #define GB_POWER_SUPPLY_PROP_CURRENT_AVG 0x12
623 #define GB_POWER_SUPPLY_PROP_CURRENT_BOOT 0x13
624 #define GB_POWER_SUPPLY_PROP_POWER_NOW 0x14
625 #define GB_POWER_SUPPLY_PROP_POWER_AVG 0x15
626 #define GB_POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN 0x16
627 #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN 0x17
628 #define GB_POWER_SUPPLY_PROP_CHARGE_FULL 0x18
629 #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY 0x19
630 #define GB_POWER_SUPPLY_PROP_CHARGE_NOW 0x1A
631 #define GB_POWER_SUPPLY_PROP_CHARGE_AVG 0x1B
632 #define GB_POWER_SUPPLY_PROP_CHARGE_COUNTER 0x1C
633 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT 0x1D
634 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX 0x1E
635 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE 0x1F
636 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX 0x20
637 #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT 0x21
638 #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX 0x22
639 #define GB_POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT 0x23
640 #define GB_POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN 0x24
641 #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN 0x25
642 #define GB_POWER_SUPPLY_PROP_ENERGY_FULL 0x26
643 #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY 0x27
644 #define GB_POWER_SUPPLY_PROP_ENERGY_NOW 0x28
645 #define GB_POWER_SUPPLY_PROP_ENERGY_AVG 0x29
646 #define GB_POWER_SUPPLY_PROP_CAPACITY 0x2A
647 #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN 0x2B
648 #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX 0x2C
649 #define GB_POWER_SUPPLY_PROP_CAPACITY_LEVEL 0x2D
650 #define GB_POWER_SUPPLY_PROP_TEMP 0x2E
651 #define GB_POWER_SUPPLY_PROP_TEMP_MAX 0x2F
652 #define GB_POWER_SUPPLY_PROP_TEMP_MIN 0x30
653 #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MIN 0x31
654 #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MAX 0x32
655 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT 0x33
656 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN 0x34
657 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX 0x35
658 #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW 0x36
659 #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG 0x37
660 #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_NOW 0x38
661 #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_AVG 0x39
662 #define GB_POWER_SUPPLY_PROP_TYPE 0x3A
663 #define GB_POWER_SUPPLY_PROP_SCOPE 0x3B
664 #define GB_POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT 0x3C
665 #define GB_POWER_SUPPLY_PROP_CALIBRATE 0x3D
666 __u8 is_writeable;
667 } __packed;
669 struct gb_power_supply_get_property_descriptors_request {
670 __u8 psy_id;
671 } __packed;
673 struct gb_power_supply_get_property_descriptors_response {
674 __u8 properties_count;
675 struct gb_power_supply_props_desc props[];
676 } __packed;
678 struct gb_power_supply_get_property_request {
679 __u8 psy_id;
680 __u8 property;
681 } __packed;
683 struct gb_power_supply_get_property_response {
684 __le32 prop_val;
687 struct gb_power_supply_set_property_request {
688 __u8 psy_id;
689 __u8 property;
690 __le32 prop_val;
691 } __packed;
693 struct gb_power_supply_event_request {
694 __u8 psy_id;
695 __u8 event;
696 #define GB_POWER_SUPPLY_UPDATE 0x01
697 } __packed;
700 /* HID */
702 /* Greybus HID operation types */
703 #define GB_HID_TYPE_GET_DESC 0x02
704 #define GB_HID_TYPE_GET_REPORT_DESC 0x03
705 #define GB_HID_TYPE_PWR_ON 0x04
706 #define GB_HID_TYPE_PWR_OFF 0x05
707 #define GB_HID_TYPE_GET_REPORT 0x06
708 #define GB_HID_TYPE_SET_REPORT 0x07
709 #define GB_HID_TYPE_IRQ_EVENT 0x08
711 /* Report type */
712 #define GB_HID_INPUT_REPORT 0
713 #define GB_HID_OUTPUT_REPORT 1
714 #define GB_HID_FEATURE_REPORT 2
716 /* Different request/response structures */
717 /* HID get descriptor response */
718 struct gb_hid_desc_response {
719 __u8 bLength;
720 __le16 wReportDescLength;
721 __le16 bcdHID;
722 __le16 wProductID;
723 __le16 wVendorID;
724 __u8 bCountryCode;
725 } __packed;
727 /* HID get report request/response */
728 struct gb_hid_get_report_request {
729 __u8 report_type;
730 __u8 report_id;
731 } __packed;
733 /* HID set report request */
734 struct gb_hid_set_report_request {
735 __u8 report_type;
736 __u8 report_id;
737 __u8 report[0];
738 } __packed;
740 /* HID input report request, via interrupt pipe */
741 struct gb_hid_input_report_request {
742 __u8 report[0];
743 } __packed;
746 /* I2C */
748 /* Greybus i2c request types */
749 #define GB_I2C_TYPE_FUNCTIONALITY 0x02
750 #define GB_I2C_TYPE_TRANSFER 0x05
752 /* functionality request has no payload */
753 struct gb_i2c_functionality_response {
754 __le32 functionality;
755 } __packed;
758 * Outgoing data immediately follows the op count and ops array.
759 * The data for each write (master -> slave) op in the array is sent
760 * in order, with no (e.g. pad) bytes separating them.
762 * Short reads cause the entire transfer request to fail So response
763 * payload consists only of bytes read, and the number of bytes is
764 * exactly what was specified in the corresponding op. Like
765 * outgoing data, the incoming data is in order and contiguous.
767 struct gb_i2c_transfer_op {
768 __le16 addr;
769 __le16 flags;
770 __le16 size;
771 } __packed;
773 struct gb_i2c_transfer_request {
774 __le16 op_count;
775 struct gb_i2c_transfer_op ops[0]; /* op_count of these */
776 } __packed;
777 struct gb_i2c_transfer_response {
778 __u8 data[0]; /* inbound data */
779 } __packed;
782 /* GPIO */
784 /* Greybus GPIO request types */
785 #define GB_GPIO_TYPE_LINE_COUNT 0x02
786 #define GB_GPIO_TYPE_ACTIVATE 0x03
787 #define GB_GPIO_TYPE_DEACTIVATE 0x04
788 #define GB_GPIO_TYPE_GET_DIRECTION 0x05
789 #define GB_GPIO_TYPE_DIRECTION_IN 0x06
790 #define GB_GPIO_TYPE_DIRECTION_OUT 0x07
791 #define GB_GPIO_TYPE_GET_VALUE 0x08
792 #define GB_GPIO_TYPE_SET_VALUE 0x09
793 #define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a
794 #define GB_GPIO_TYPE_IRQ_TYPE 0x0b
795 #define GB_GPIO_TYPE_IRQ_MASK 0x0c
796 #define GB_GPIO_TYPE_IRQ_UNMASK 0x0d
797 #define GB_GPIO_TYPE_IRQ_EVENT 0x0e
799 #define GB_GPIO_IRQ_TYPE_NONE 0x00
800 #define GB_GPIO_IRQ_TYPE_EDGE_RISING 0x01
801 #define GB_GPIO_IRQ_TYPE_EDGE_FALLING 0x02
802 #define GB_GPIO_IRQ_TYPE_EDGE_BOTH 0x03
803 #define GB_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04
804 #define GB_GPIO_IRQ_TYPE_LEVEL_LOW 0x08
806 /* line count request has no payload */
807 struct gb_gpio_line_count_response {
808 __u8 count;
809 } __packed;
811 struct gb_gpio_activate_request {
812 __u8 which;
813 } __packed;
814 /* activate response has no payload */
816 struct gb_gpio_deactivate_request {
817 __u8 which;
818 } __packed;
819 /* deactivate response has no payload */
821 struct gb_gpio_get_direction_request {
822 __u8 which;
823 } __packed;
824 struct gb_gpio_get_direction_response {
825 __u8 direction;
826 } __packed;
828 struct gb_gpio_direction_in_request {
829 __u8 which;
830 } __packed;
831 /* direction in response has no payload */
833 struct gb_gpio_direction_out_request {
834 __u8 which;
835 __u8 value;
836 } __packed;
837 /* direction out response has no payload */
839 struct gb_gpio_get_value_request {
840 __u8 which;
841 } __packed;
842 struct gb_gpio_get_value_response {
843 __u8 value;
844 } __packed;
846 struct gb_gpio_set_value_request {
847 __u8 which;
848 __u8 value;
849 } __packed;
850 /* set value response has no payload */
852 struct gb_gpio_set_debounce_request {
853 __u8 which;
854 __le16 usec;
855 } __packed;
856 /* debounce response has no payload */
858 struct gb_gpio_irq_type_request {
859 __u8 which;
860 __u8 type;
861 } __packed;
862 /* irq type response has no payload */
864 struct gb_gpio_irq_mask_request {
865 __u8 which;
866 } __packed;
867 /* irq mask response has no payload */
869 struct gb_gpio_irq_unmask_request {
870 __u8 which;
871 } __packed;
872 /* irq unmask response has no payload */
874 /* irq event requests originate on another module and are handled on the AP */
875 struct gb_gpio_irq_event_request {
876 __u8 which;
877 } __packed;
878 /* irq event has no response */
881 /* PWM */
883 /* Greybus PWM operation types */
884 #define GB_PWM_TYPE_PWM_COUNT 0x02
885 #define GB_PWM_TYPE_ACTIVATE 0x03
886 #define GB_PWM_TYPE_DEACTIVATE 0x04
887 #define GB_PWM_TYPE_CONFIG 0x05
888 #define GB_PWM_TYPE_POLARITY 0x06
889 #define GB_PWM_TYPE_ENABLE 0x07
890 #define GB_PWM_TYPE_DISABLE 0x08
892 /* pwm count request has no payload */
893 struct gb_pwm_count_response {
894 __u8 count;
895 } __packed;
897 struct gb_pwm_activate_request {
898 __u8 which;
899 } __packed;
901 struct gb_pwm_deactivate_request {
902 __u8 which;
903 } __packed;
905 struct gb_pwm_config_request {
906 __u8 which;
907 __le32 duty;
908 __le32 period;
909 } __packed;
911 struct gb_pwm_polarity_request {
912 __u8 which;
913 __u8 polarity;
914 } __packed;
916 struct gb_pwm_enable_request {
917 __u8 which;
918 } __packed;
920 struct gb_pwm_disable_request {
921 __u8 which;
922 } __packed;
924 /* SPI */
926 /* Should match up with modes in linux/spi/spi.h */
927 #define GB_SPI_MODE_CPHA 0x01 /* clock phase */
928 #define GB_SPI_MODE_CPOL 0x02 /* clock polarity */
929 #define GB_SPI_MODE_MODE_0 (0|0) /* (original MicroWire) */
930 #define GB_SPI_MODE_MODE_1 (0|GB_SPI_MODE_CPHA)
931 #define GB_SPI_MODE_MODE_2 (GB_SPI_MODE_CPOL|0)
932 #define GB_SPI_MODE_MODE_3 (GB_SPI_MODE_CPOL|GB_SPI_MODE_CPHA)
933 #define GB_SPI_MODE_CS_HIGH 0x04 /* chipselect active high? */
934 #define GB_SPI_MODE_LSB_FIRST 0x08 /* per-word bits-on-wire */
935 #define GB_SPI_MODE_3WIRE 0x10 /* SI/SO signals shared */
936 #define GB_SPI_MODE_LOOP 0x20 /* loopback mode */
937 #define GB_SPI_MODE_NO_CS 0x40 /* 1 dev/bus, no chipselect */
938 #define GB_SPI_MODE_READY 0x80 /* slave pulls low to pause */
940 /* Should match up with flags in linux/spi/spi.h */
941 #define GB_SPI_FLAG_HALF_DUPLEX BIT(0) /* can't do full duplex */
942 #define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */
943 #define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */
945 /* Greybus spi operation types */
946 #define GB_SPI_TYPE_MASTER_CONFIG 0x02
947 #define GB_SPI_TYPE_DEVICE_CONFIG 0x03
948 #define GB_SPI_TYPE_TRANSFER 0x04
950 /* mode request has no payload */
951 struct gb_spi_master_config_response {
952 __le32 bits_per_word_mask;
953 __le32 min_speed_hz;
954 __le32 max_speed_hz;
955 __le16 mode;
956 __le16 flags;
957 __u8 num_chipselect;
958 } __packed;
960 struct gb_spi_device_config_request {
961 __u8 chip_select;
962 } __packed;
964 struct gb_spi_device_config_response {
965 __le16 mode;
966 __u8 bits_per_word;
967 __le32 max_speed_hz;
968 __u8 device_type;
969 #define GB_SPI_SPI_DEV 0x00
970 #define GB_SPI_SPI_NOR 0x01
971 #define GB_SPI_SPI_MODALIAS 0x02
972 __u8 name[32];
973 } __packed;
976 * struct gb_spi_transfer - a read/write buffer pair
977 * @speed_hz: Select a speed other than the device default for this transfer. If
978 * 0 the default (from @spi_device) is used.
979 * @len: size of rx and tx buffers (in bytes)
980 * @delay_usecs: microseconds to delay after this transfer before (optionally)
981 * changing the chipselect status, then starting the next transfer or
982 * completing this spi_message.
983 * @cs_change: affects chipselect after this transfer completes
984 * @bits_per_word: select a bits_per_word other than the device default for this
985 * transfer. If 0 the default (from @spi_device) is used.
987 struct gb_spi_transfer {
988 __le32 speed_hz;
989 __le32 len;
990 __le16 delay_usecs;
991 __u8 cs_change;
992 __u8 bits_per_word;
993 __u8 xfer_flags;
994 #define GB_SPI_XFER_READ 0x01
995 #define GB_SPI_XFER_WRITE 0x02
996 #define GB_SPI_XFER_INPROGRESS 0x04
997 } __packed;
999 struct gb_spi_transfer_request {
1000 __u8 chip_select; /* of the spi device */
1001 __u8 mode; /* of the spi device */
1002 __le16 count;
1003 struct gb_spi_transfer transfers[0]; /* count of these */
1004 } __packed;
1006 struct gb_spi_transfer_response {
1007 __u8 data[0]; /* inbound data */
1008 } __packed;
1010 /* Version of the Greybus SVC protocol we support */
1011 #define GB_SVC_VERSION_MAJOR 0x00
1012 #define GB_SVC_VERSION_MINOR 0x01
1014 /* Greybus SVC request types */
1015 #define GB_SVC_TYPE_PROTOCOL_VERSION 0x01
1016 #define GB_SVC_TYPE_SVC_HELLO 0x02
1017 #define GB_SVC_TYPE_INTF_DEVICE_ID 0x03
1018 #define GB_SVC_TYPE_INTF_RESET 0x06
1019 #define GB_SVC_TYPE_CONN_CREATE 0x07
1020 #define GB_SVC_TYPE_CONN_DESTROY 0x08
1021 #define GB_SVC_TYPE_DME_PEER_GET 0x09
1022 #define GB_SVC_TYPE_DME_PEER_SET 0x0a
1023 #define GB_SVC_TYPE_ROUTE_CREATE 0x0b
1024 #define GB_SVC_TYPE_ROUTE_DESTROY 0x0c
1025 #define GB_SVC_TYPE_TIMESYNC_ENABLE 0x0d
1026 #define GB_SVC_TYPE_TIMESYNC_DISABLE 0x0e
1027 #define GB_SVC_TYPE_TIMESYNC_AUTHORITATIVE 0x0f
1028 #define GB_SVC_TYPE_INTF_SET_PWRM 0x10
1029 #define GB_SVC_TYPE_INTF_EJECT 0x11
1030 #define GB_SVC_TYPE_KEY_EVENT 0x12
1031 #define GB_SVC_TYPE_PING 0x13
1032 #define GB_SVC_TYPE_PWRMON_RAIL_COUNT_GET 0x14
1033 #define GB_SVC_TYPE_PWRMON_RAIL_NAMES_GET 0x15
1034 #define GB_SVC_TYPE_PWRMON_SAMPLE_GET 0x16
1035 #define GB_SVC_TYPE_PWRMON_INTF_SAMPLE_GET 0x17
1036 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_ACQUIRE 0x18
1037 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_RELEASE 0x19
1038 #define GB_SVC_TYPE_TIMESYNC_PING 0x1a
1039 #define GB_SVC_TYPE_CONN_QUIESCING 0x1e
1040 #define GB_SVC_TYPE_MODULE_INSERTED 0x1f
1041 #define GB_SVC_TYPE_MODULE_REMOVED 0x20
1042 #define GB_SVC_TYPE_INTF_VSYS_ENABLE 0x21
1043 #define GB_SVC_TYPE_INTF_VSYS_DISABLE 0x22
1044 #define GB_SVC_TYPE_INTF_REFCLK_ENABLE 0x23
1045 #define GB_SVC_TYPE_INTF_REFCLK_DISABLE 0x24
1046 #define GB_SVC_TYPE_INTF_UNIPRO_ENABLE 0x25
1047 #define GB_SVC_TYPE_INTF_UNIPRO_DISABLE 0x26
1048 #define GB_SVC_TYPE_INTF_ACTIVATE 0x27
1049 #define GB_SVC_TYPE_INTF_RESUME 0x28
1050 #define GB_SVC_TYPE_INTF_MAILBOX_EVENT 0x29
1052 /* Greybus SVC protocol status values */
1053 #define GB_SVC_OP_SUCCESS 0x00
1054 #define GB_SVC_OP_UNKNOWN_ERROR 0x01
1055 #define GB_SVC_INTF_NOT_DETECTED 0x02
1056 #define GB_SVC_INTF_NO_UPRO_LINK 0x03
1057 #define GB_SVC_INTF_UPRO_NOT_DOWN 0x04
1058 #define GB_SVC_INTF_UPRO_NOT_HIBERNATED 0x05
1059 #define GB_SVC_INTF_NO_V_SYS 0x06
1060 #define GB_SVC_INTF_V_CHG 0x07
1061 #define GB_SVC_INTF_WAKE_BUSY 0x08
1062 #define GB_SVC_INTF_NO_REFCLK 0x09
1063 #define GB_SVC_INTF_RELEASING 0x0a
1064 #define GB_SVC_INTF_NO_ORDER 0x0b
1065 #define GB_SVC_INTF_MBOX_SET 0x0c
1066 #define GB_SVC_INTF_BAD_MBOX 0x0d
1067 #define GB_SVC_INTF_OP_TIMEOUT 0x0e
1068 #define GB_SVC_PWRMON_OP_NOT_PRESENT 0x0f
1070 struct gb_svc_version_request {
1071 __u8 major;
1072 __u8 minor;
1073 } __packed;
1075 struct gb_svc_version_response {
1076 __u8 major;
1077 __u8 minor;
1078 } __packed;
1080 /* SVC protocol hello request */
1081 struct gb_svc_hello_request {
1082 __le16 endo_id;
1083 __u8 interface_id;
1084 } __packed;
1085 /* hello response has no payload */
1087 struct gb_svc_intf_device_id_request {
1088 __u8 intf_id;
1089 __u8 device_id;
1090 } __packed;
1091 /* device id response has no payload */
1093 struct gb_svc_intf_reset_request {
1094 __u8 intf_id;
1095 } __packed;
1096 /* interface reset response has no payload */
1098 struct gb_svc_intf_eject_request {
1099 __u8 intf_id;
1100 } __packed;
1101 /* interface eject response has no payload */
1103 struct gb_svc_conn_create_request {
1104 __u8 intf1_id;
1105 __le16 cport1_id;
1106 __u8 intf2_id;
1107 __le16 cport2_id;
1108 __u8 tc;
1109 __u8 flags;
1110 } __packed;
1111 /* connection create response has no payload */
1113 struct gb_svc_conn_destroy_request {
1114 __u8 intf1_id;
1115 __le16 cport1_id;
1116 __u8 intf2_id;
1117 __le16 cport2_id;
1118 } __packed;
1119 /* connection destroy response has no payload */
1121 struct gb_svc_dme_peer_get_request {
1122 __u8 intf_id;
1123 __le16 attr;
1124 __le16 selector;
1125 } __packed;
1127 struct gb_svc_dme_peer_get_response {
1128 __le16 result_code;
1129 __le32 attr_value;
1130 } __packed;
1132 struct gb_svc_dme_peer_set_request {
1133 __u8 intf_id;
1134 __le16 attr;
1135 __le16 selector;
1136 __le32 value;
1137 } __packed;
1139 struct gb_svc_dme_peer_set_response {
1140 __le16 result_code;
1141 } __packed;
1143 /* Greybus init-status values, currently retrieved using DME peer gets. */
1144 #define GB_INIT_SPI_BOOT_STARTED 0x02
1145 #define GB_INIT_TRUSTED_SPI_BOOT_FINISHED 0x03
1146 #define GB_INIT_UNTRUSTED_SPI_BOOT_FINISHED 0x04
1147 #define GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED 0x06
1148 #define GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED 0x09
1150 struct gb_svc_route_create_request {
1151 __u8 intf1_id;
1152 __u8 dev1_id;
1153 __u8 intf2_id;
1154 __u8 dev2_id;
1155 } __packed;
1156 /* route create response has no payload */
1158 struct gb_svc_route_destroy_request {
1159 __u8 intf1_id;
1160 __u8 intf2_id;
1161 } __packed;
1162 /* route destroy response has no payload */
1164 /* used for svc_intf_vsys_{enable,disable} */
1165 struct gb_svc_intf_vsys_request {
1166 __u8 intf_id;
1167 } __packed;
1169 struct gb_svc_intf_vsys_response {
1170 __u8 result_code;
1171 #define GB_SVC_INTF_VSYS_OK 0x00
1172 /* 0x01 is reserved */
1173 #define GB_SVC_INTF_VSYS_FAIL 0x02
1174 } __packed;
1176 /* used for svc_intf_refclk_{enable,disable} */
1177 struct gb_svc_intf_refclk_request {
1178 __u8 intf_id;
1179 } __packed;
1181 struct gb_svc_intf_refclk_response {
1182 __u8 result_code;
1183 #define GB_SVC_INTF_REFCLK_OK 0x00
1184 /* 0x01 is reserved */
1185 #define GB_SVC_INTF_REFCLK_FAIL 0x02
1186 } __packed;
1188 /* used for svc_intf_unipro_{enable,disable} */
1189 struct gb_svc_intf_unipro_request {
1190 __u8 intf_id;
1191 } __packed;
1193 struct gb_svc_intf_unipro_response {
1194 __u8 result_code;
1195 #define GB_SVC_INTF_UNIPRO_OK 0x00
1196 /* 0x01 is reserved */
1197 #define GB_SVC_INTF_UNIPRO_FAIL 0x02
1198 #define GB_SVC_INTF_UNIPRO_NOT_OFF 0x03
1199 } __packed;
1201 struct gb_svc_timesync_enable_request {
1202 __u8 count;
1203 __le64 frame_time;
1204 __le32 strobe_delay;
1205 __le32 refclk;
1206 } __packed;
1207 /* timesync enable response has no payload */
1209 /* timesync authoritative request has no payload */
1210 struct gb_svc_timesync_authoritative_response {
1211 __le64 frame_time[GB_TIMESYNC_MAX_STROBES];
1214 struct gb_svc_timesync_wake_pins_acquire_request {
1215 __le32 strobe_mask;
1218 /* timesync wake pins acquire response has no payload */
1220 /* timesync wake pins release request has no payload */
1221 /* timesync wake pins release response has no payload */
1223 /* timesync svc ping request has no payload */
1224 struct gb_svc_timesync_ping_response {
1225 __le64 frame_time;
1226 } __packed;
1228 #define GB_SVC_UNIPRO_FAST_MODE 0x01
1229 #define GB_SVC_UNIPRO_SLOW_MODE 0x02
1230 #define GB_SVC_UNIPRO_FAST_AUTO_MODE 0x04
1231 #define GB_SVC_UNIPRO_SLOW_AUTO_MODE 0x05
1232 #define GB_SVC_UNIPRO_MODE_UNCHANGED 0x07
1233 #define GB_SVC_UNIPRO_HIBERNATE_MODE 0x11
1234 #define GB_SVC_UNIPRO_OFF_MODE 0x12
1236 #define GB_SVC_SMALL_AMPLITUDE 0x01
1237 #define GB_SVC_LARGE_AMPLITUDE 0x02
1239 #define GB_SVC_NO_DE_EMPHASIS 0x00
1240 #define GB_SVC_SMALL_DE_EMPHASIS 0x01
1241 #define GB_SVC_LARGE_DE_EMPHASIS 0x02
1243 #define GB_SVC_PWRM_RXTERMINATION 0x01
1244 #define GB_SVC_PWRM_TXTERMINATION 0x02
1245 #define GB_SVC_PWRM_LINE_RESET 0x04
1246 #define GB_SVC_PWRM_SCRAMBLING 0x20
1248 #define GB_SVC_PWRM_QUIRK_HSSER 0x00000001
1250 #define GB_SVC_UNIPRO_HS_SERIES_A 0x01
1251 #define GB_SVC_UNIPRO_HS_SERIES_B 0x02
1253 #define GB_SVC_SETPWRM_PWR_OK 0x00
1254 #define GB_SVC_SETPWRM_PWR_LOCAL 0x01
1255 #define GB_SVC_SETPWRM_PWR_REMOTE 0x02
1256 #define GB_SVC_SETPWRM_PWR_BUSY 0x03
1257 #define GB_SVC_SETPWRM_PWR_ERROR_CAP 0x04
1258 #define GB_SVC_SETPWRM_PWR_FATAL_ERROR 0x05
1260 struct gb_svc_l2_timer_cfg {
1261 __le16 tsb_fc0_protection_timeout;
1262 __le16 tsb_tc0_replay_timeout;
1263 __le16 tsb_afc0_req_timeout;
1264 __le16 tsb_fc1_protection_timeout;
1265 __le16 tsb_tc1_replay_timeout;
1266 __le16 tsb_afc1_req_timeout;
1267 __le16 reserved_for_tc2[3];
1268 __le16 reserved_for_tc3[3];
1269 } __packed;
1271 struct gb_svc_intf_set_pwrm_request {
1272 __u8 intf_id;
1273 __u8 hs_series;
1274 __u8 tx_mode;
1275 __u8 tx_gear;
1276 __u8 tx_nlanes;
1277 __u8 tx_amplitude;
1278 __u8 tx_hs_equalizer;
1279 __u8 rx_mode;
1280 __u8 rx_gear;
1281 __u8 rx_nlanes;
1282 __u8 flags;
1283 __le32 quirks;
1284 struct gb_svc_l2_timer_cfg local_l2timerdata, remote_l2timerdata;
1285 } __packed;
1287 struct gb_svc_intf_set_pwrm_response {
1288 __u8 result_code;
1289 } __packed;
1291 struct gb_svc_key_event_request {
1292 __le16 key_code;
1293 #define GB_KEYCODE_ARA 0x00
1295 __u8 key_event;
1296 #define GB_SVC_KEY_RELEASED 0x00
1297 #define GB_SVC_KEY_PRESSED 0x01
1298 } __packed;
1300 #define GB_SVC_PWRMON_MAX_RAIL_COUNT 254
1302 struct gb_svc_pwrmon_rail_count_get_response {
1303 __u8 rail_count;
1304 } __packed;
1306 #define GB_SVC_PWRMON_RAIL_NAME_BUFSIZE 32
1308 struct gb_svc_pwrmon_rail_names_get_response {
1309 __u8 status;
1310 __u8 name[0][GB_SVC_PWRMON_RAIL_NAME_BUFSIZE];
1311 } __packed;
1313 #define GB_SVC_PWRMON_TYPE_CURR 0x01
1314 #define GB_SVC_PWRMON_TYPE_VOL 0x02
1315 #define GB_SVC_PWRMON_TYPE_PWR 0x03
1317 #define GB_SVC_PWRMON_GET_SAMPLE_OK 0x00
1318 #define GB_SVC_PWRMON_GET_SAMPLE_INVAL 0x01
1319 #define GB_SVC_PWRMON_GET_SAMPLE_NOSUPP 0x02
1320 #define GB_SVC_PWRMON_GET_SAMPLE_HWERR 0x03
1322 struct gb_svc_pwrmon_sample_get_request {
1323 __u8 rail_id;
1324 __u8 measurement_type;
1325 } __packed;
1327 struct gb_svc_pwrmon_sample_get_response {
1328 __u8 result;
1329 __le32 measurement;
1330 } __packed;
1332 struct gb_svc_pwrmon_intf_sample_get_request {
1333 __u8 intf_id;
1334 __u8 measurement_type;
1335 } __packed;
1337 struct gb_svc_pwrmon_intf_sample_get_response {
1338 __u8 result;
1339 __le32 measurement;
1340 } __packed;
1342 #define GB_SVC_MODULE_INSERTED_FLAG_NO_PRIMARY 0x0001
1344 struct gb_svc_module_inserted_request {
1345 __u8 primary_intf_id;
1346 __u8 intf_count;
1347 __le16 flags;
1348 } __packed;
1349 /* module_inserted response has no payload */
1351 struct gb_svc_module_removed_request {
1352 __u8 primary_intf_id;
1353 } __packed;
1354 /* module_removed response has no payload */
1356 struct gb_svc_intf_activate_request {
1357 __u8 intf_id;
1358 } __packed;
1360 #define GB_SVC_INTF_TYPE_UNKNOWN 0x00
1361 #define GB_SVC_INTF_TYPE_DUMMY 0x01
1362 #define GB_SVC_INTF_TYPE_UNIPRO 0x02
1363 #define GB_SVC_INTF_TYPE_GREYBUS 0x03
1365 struct gb_svc_intf_activate_response {
1366 __u8 status;
1367 __u8 intf_type;
1368 } __packed;
1370 struct gb_svc_intf_resume_request {
1371 __u8 intf_id;
1372 } __packed;
1374 struct gb_svc_intf_resume_response {
1375 __u8 status;
1376 } __packed;
1378 #define GB_SVC_INTF_MAILBOX_NONE 0x00
1379 #define GB_SVC_INTF_MAILBOX_AP 0x01
1380 #define GB_SVC_INTF_MAILBOX_GREYBUS 0x02
1382 struct gb_svc_intf_mailbox_event_request {
1383 __u8 intf_id;
1384 __le16 result_code;
1385 __le32 mailbox;
1386 } __packed;
1387 /* intf_mailbox_event response has no payload */
1389 struct gb_svc_conn_quiescing_request {
1390 __u8 intf1_id;
1391 __le16 cport1_id;
1392 __u8 intf2_id;
1393 __le16 cport2_id;
1394 } __packed;
1396 struct gb_svc_conn_quiescing_response {
1397 __u8 status;
1398 } __packed;
1401 /* RAW */
1403 /* Greybus raw request types */
1404 #define GB_RAW_TYPE_SEND 0x02
1406 struct gb_raw_send_request {
1407 __le32 len;
1408 __u8 data[0];
1409 } __packed;
1412 /* UART */
1414 /* Greybus UART operation types */
1415 #define GB_UART_TYPE_SEND_DATA 0x02
1416 #define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */
1417 #define GB_UART_TYPE_SET_LINE_CODING 0x04
1418 #define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05
1419 #define GB_UART_TYPE_SEND_BREAK 0x06
1420 #define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
1421 #define GB_UART_TYPE_RECEIVE_CREDITS 0x08
1422 #define GB_UART_TYPE_FLUSH_FIFOS 0x09
1424 /* Represents data from AP -> Module */
1425 struct gb_uart_send_data_request {
1426 __le16 size;
1427 __u8 data[0];
1428 } __packed;
1430 /* recv-data-request flags */
1431 #define GB_UART_RECV_FLAG_FRAMING 0x01 /* Framing error */
1432 #define GB_UART_RECV_FLAG_PARITY 0x02 /* Parity error */
1433 #define GB_UART_RECV_FLAG_OVERRUN 0x04 /* Overrun error */
1434 #define GB_UART_RECV_FLAG_BREAK 0x08 /* Break */
1436 /* Represents data from Module -> AP */
1437 struct gb_uart_recv_data_request {
1438 __le16 size;
1439 __u8 flags;
1440 __u8 data[0];
1441 } __packed;
1443 struct gb_uart_receive_credits_request {
1444 __le16 count;
1445 } __packed;
1447 struct gb_uart_set_line_coding_request {
1448 __le32 rate;
1449 __u8 format;
1450 #define GB_SERIAL_1_STOP_BITS 0
1451 #define GB_SERIAL_1_5_STOP_BITS 1
1452 #define GB_SERIAL_2_STOP_BITS 2
1454 __u8 parity;
1455 #define GB_SERIAL_NO_PARITY 0
1456 #define GB_SERIAL_ODD_PARITY 1
1457 #define GB_SERIAL_EVEN_PARITY 2
1458 #define GB_SERIAL_MARK_PARITY 3
1459 #define GB_SERIAL_SPACE_PARITY 4
1461 __u8 data_bits;
1463 __u8 flow_control;
1464 #define GB_SERIAL_AUTO_RTSCTS_EN 0x1
1465 } __packed;
1467 /* output control lines */
1468 #define GB_UART_CTRL_DTR 0x01
1469 #define GB_UART_CTRL_RTS 0x02
1471 struct gb_uart_set_control_line_state_request {
1472 __u8 control;
1473 } __packed;
1475 struct gb_uart_set_break_request {
1476 __u8 state;
1477 } __packed;
1479 /* input control lines and line errors */
1480 #define GB_UART_CTRL_DCD 0x01
1481 #define GB_UART_CTRL_DSR 0x02
1482 #define GB_UART_CTRL_RI 0x04
1484 struct gb_uart_serial_state_request {
1485 __u8 control;
1486 } __packed;
1488 struct gb_uart_serial_flush_request {
1489 __u8 flags;
1490 #define GB_SERIAL_FLAG_FLUSH_TRANSMITTER 0x01
1491 #define GB_SERIAL_FLAG_FLUSH_RECEIVER 0x02
1492 } __packed;
1494 /* Loopback */
1496 /* Greybus loopback request types */
1497 #define GB_LOOPBACK_TYPE_PING 0x02
1498 #define GB_LOOPBACK_TYPE_TRANSFER 0x03
1499 #define GB_LOOPBACK_TYPE_SINK 0x04
1502 * Loopback request/response header format should be identical
1503 * to simplify bandwidth and data movement analysis.
1505 struct gb_loopback_transfer_request {
1506 __le32 len;
1507 __le32 reserved0;
1508 __le32 reserved1;
1509 __u8 data[0];
1510 } __packed;
1512 struct gb_loopback_transfer_response {
1513 __le32 len;
1514 __le32 reserved0;
1515 __le32 reserved1;
1516 __u8 data[0];
1517 } __packed;
1519 /* SDIO */
1520 /* Greybus SDIO operation types */
1521 #define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
1522 #define GB_SDIO_TYPE_SET_IOS 0x03
1523 #define GB_SDIO_TYPE_COMMAND 0x04
1524 #define GB_SDIO_TYPE_TRANSFER 0x05
1525 #define GB_SDIO_TYPE_EVENT 0x06
1527 /* get caps response: request has no payload */
1528 struct gb_sdio_get_caps_response {
1529 __le32 caps;
1530 #define GB_SDIO_CAP_NONREMOVABLE 0x00000001
1531 #define GB_SDIO_CAP_4_BIT_DATA 0x00000002
1532 #define GB_SDIO_CAP_8_BIT_DATA 0x00000004
1533 #define GB_SDIO_CAP_MMC_HS 0x00000008
1534 #define GB_SDIO_CAP_SD_HS 0x00000010
1535 #define GB_SDIO_CAP_ERASE 0x00000020
1536 #define GB_SDIO_CAP_1_2V_DDR 0x00000040
1537 #define GB_SDIO_CAP_1_8V_DDR 0x00000080
1538 #define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100
1539 #define GB_SDIO_CAP_UHS_SDR12 0x00000200
1540 #define GB_SDIO_CAP_UHS_SDR25 0x00000400
1541 #define GB_SDIO_CAP_UHS_SDR50 0x00000800
1542 #define GB_SDIO_CAP_UHS_SDR104 0x00001000
1543 #define GB_SDIO_CAP_UHS_DDR50 0x00002000
1544 #define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000
1545 #define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000
1546 #define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000
1547 #define GB_SDIO_CAP_HS200_1_2V 0x00020000
1548 #define GB_SDIO_CAP_HS200_1_8V 0x00040000
1549 #define GB_SDIO_CAP_HS400_1_2V 0x00080000
1550 #define GB_SDIO_CAP_HS400_1_8V 0x00100000
1552 /* see possible values below at vdd */
1553 __le32 ocr;
1554 __le16 max_blk_count;
1555 __le16 max_blk_size;
1556 __le32 f_min;
1557 __le32 f_max;
1558 } __packed;
1560 /* set ios request: response has no payload */
1561 struct gb_sdio_set_ios_request {
1562 __le32 clock;
1563 __le32 vdd;
1564 #define GB_SDIO_VDD_165_195 0x00000001
1565 #define GB_SDIO_VDD_20_21 0x00000002
1566 #define GB_SDIO_VDD_21_22 0x00000004
1567 #define GB_SDIO_VDD_22_23 0x00000008
1568 #define GB_SDIO_VDD_23_24 0x00000010
1569 #define GB_SDIO_VDD_24_25 0x00000020
1570 #define GB_SDIO_VDD_25_26 0x00000040
1571 #define GB_SDIO_VDD_26_27 0x00000080
1572 #define GB_SDIO_VDD_27_28 0x00000100
1573 #define GB_SDIO_VDD_28_29 0x00000200
1574 #define GB_SDIO_VDD_29_30 0x00000400
1575 #define GB_SDIO_VDD_30_31 0x00000800
1576 #define GB_SDIO_VDD_31_32 0x00001000
1577 #define GB_SDIO_VDD_32_33 0x00002000
1578 #define GB_SDIO_VDD_33_34 0x00004000
1579 #define GB_SDIO_VDD_34_35 0x00008000
1580 #define GB_SDIO_VDD_35_36 0x00010000
1582 __u8 bus_mode;
1583 #define GB_SDIO_BUSMODE_OPENDRAIN 0x00
1584 #define GB_SDIO_BUSMODE_PUSHPULL 0x01
1586 __u8 power_mode;
1587 #define GB_SDIO_POWER_OFF 0x00
1588 #define GB_SDIO_POWER_UP 0x01
1589 #define GB_SDIO_POWER_ON 0x02
1590 #define GB_SDIO_POWER_UNDEFINED 0x03
1592 __u8 bus_width;
1593 #define GB_SDIO_BUS_WIDTH_1 0x00
1594 #define GB_SDIO_BUS_WIDTH_4 0x02
1595 #define GB_SDIO_BUS_WIDTH_8 0x03
1597 __u8 timing;
1598 #define GB_SDIO_TIMING_LEGACY 0x00
1599 #define GB_SDIO_TIMING_MMC_HS 0x01
1600 #define GB_SDIO_TIMING_SD_HS 0x02
1601 #define GB_SDIO_TIMING_UHS_SDR12 0x03
1602 #define GB_SDIO_TIMING_UHS_SDR25 0x04
1603 #define GB_SDIO_TIMING_UHS_SDR50 0x05
1604 #define GB_SDIO_TIMING_UHS_SDR104 0x06
1605 #define GB_SDIO_TIMING_UHS_DDR50 0x07
1606 #define GB_SDIO_TIMING_MMC_DDR52 0x08
1607 #define GB_SDIO_TIMING_MMC_HS200 0x09
1608 #define GB_SDIO_TIMING_MMC_HS400 0x0A
1610 __u8 signal_voltage;
1611 #define GB_SDIO_SIGNAL_VOLTAGE_330 0x00
1612 #define GB_SDIO_SIGNAL_VOLTAGE_180 0x01
1613 #define GB_SDIO_SIGNAL_VOLTAGE_120 0x02
1615 __u8 drv_type;
1616 #define GB_SDIO_SET_DRIVER_TYPE_B 0x00
1617 #define GB_SDIO_SET_DRIVER_TYPE_A 0x01
1618 #define GB_SDIO_SET_DRIVER_TYPE_C 0x02
1619 #define GB_SDIO_SET_DRIVER_TYPE_D 0x03
1620 } __packed;
1622 /* command request */
1623 struct gb_sdio_command_request {
1624 __u8 cmd;
1625 __u8 cmd_flags;
1626 #define GB_SDIO_RSP_NONE 0x00
1627 #define GB_SDIO_RSP_PRESENT 0x01
1628 #define GB_SDIO_RSP_136 0x02
1629 #define GB_SDIO_RSP_CRC 0x04
1630 #define GB_SDIO_RSP_BUSY 0x08
1631 #define GB_SDIO_RSP_OPCODE 0x10
1633 __u8 cmd_type;
1634 #define GB_SDIO_CMD_AC 0x00
1635 #define GB_SDIO_CMD_ADTC 0x01
1636 #define GB_SDIO_CMD_BC 0x02
1637 #define GB_SDIO_CMD_BCR 0x03
1639 __le32 cmd_arg;
1640 __le16 data_blocks;
1641 __le16 data_blksz;
1642 } __packed;
1644 struct gb_sdio_command_response {
1645 __le32 resp[4];
1646 } __packed;
1648 /* transfer request */
1649 struct gb_sdio_transfer_request {
1650 __u8 data_flags;
1651 #define GB_SDIO_DATA_WRITE 0x01
1652 #define GB_SDIO_DATA_READ 0x02
1653 #define GB_SDIO_DATA_STREAM 0x04
1655 __le16 data_blocks;
1656 __le16 data_blksz;
1657 __u8 data[0];
1658 } __packed;
1660 struct gb_sdio_transfer_response {
1661 __le16 data_blocks;
1662 __le16 data_blksz;
1663 __u8 data[0];
1664 } __packed;
1666 /* event request: generated by module and is defined as unidirectional */
1667 struct gb_sdio_event_request {
1668 __u8 event;
1669 #define GB_SDIO_CARD_INSERTED 0x01
1670 #define GB_SDIO_CARD_REMOVED 0x02
1671 #define GB_SDIO_WP 0x04
1672 } __packed;
1674 /* Camera */
1676 /* Greybus Camera request types */
1677 #define GB_CAMERA_TYPE_CAPABILITIES 0x02
1678 #define GB_CAMERA_TYPE_CONFIGURE_STREAMS 0x03
1679 #define GB_CAMERA_TYPE_CAPTURE 0x04
1680 #define GB_CAMERA_TYPE_FLUSH 0x05
1681 #define GB_CAMERA_TYPE_METADATA 0x06
1683 #define GB_CAMERA_MAX_STREAMS 4
1684 #define GB_CAMERA_MAX_SETTINGS_SIZE 8192
1686 /* Greybus Camera Configure Streams request payload */
1687 struct gb_camera_stream_config_request {
1688 __le16 width;
1689 __le16 height;
1690 __le16 format;
1691 __le16 padding;
1692 } __packed;
1694 struct gb_camera_configure_streams_request {
1695 __u8 num_streams;
1696 __u8 flags;
1697 #define GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY 0x01
1698 __le16 padding;
1699 struct gb_camera_stream_config_request config[0];
1700 } __packed;
1702 /* Greybus Camera Configure Streams response payload */
1703 struct gb_camera_stream_config_response {
1704 __le16 width;
1705 __le16 height;
1706 __le16 format;
1707 __u8 virtual_channel;
1708 __u8 data_type[2];
1709 __le16 max_pkt_size;
1710 __u8 padding;
1711 __le32 max_size;
1712 } __packed;
1714 struct gb_camera_configure_streams_response_deprecated {
1715 __u8 num_streams;
1716 __u8 flags;
1717 __u8 num_lanes;
1718 __u8 padding;
1719 __le32 bus_freq;
1720 __le32 lines_per_second;
1721 struct gb_camera_stream_config_response config[0];
1722 } __packed;
1723 #define GB_CAMERA_CONFIGURE_STREAMS_DEPRECATED_SIZE 12
1725 struct gb_camera_configure_streams_response {
1726 __u8 num_streams;
1727 #define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED 0x01
1728 __u8 flags;
1729 __u8 padding[2];
1730 __le32 data_rate;
1731 struct gb_camera_stream_config_response config[0];
1733 #define GB_CAMERA_CONFIGURE_STREAMS_SIZE 8
1735 /* Greybus Camera Capture request payload - response has no payload */
1736 struct gb_camera_capture_request {
1737 __le32 request_id;
1738 __u8 streams;
1739 __u8 padding;
1740 __le16 num_frames;
1741 __u8 settings[0];
1742 } __packed;
1744 /* Greybus Camera Flush response payload - request has no payload */
1745 struct gb_camera_flush_response {
1746 __le32 request_id;
1747 } __packed;
1749 /* Greybus Camera Metadata request payload - operation has no response */
1750 struct gb_camera_metadata_request {
1751 __le32 request_id;
1752 __le16 frame_number;
1753 __u8 stream;
1754 __u8 padding;
1755 __u8 metadata[0];
1756 } __packed;
1758 /* Lights */
1760 /* Greybus Lights request types */
1761 #define GB_LIGHTS_TYPE_GET_LIGHTS 0x02
1762 #define GB_LIGHTS_TYPE_GET_LIGHT_CONFIG 0x03
1763 #define GB_LIGHTS_TYPE_GET_CHANNEL_CONFIG 0x04
1764 #define GB_LIGHTS_TYPE_GET_CHANNEL_FLASH_CONFIG 0x05
1765 #define GB_LIGHTS_TYPE_SET_BRIGHTNESS 0x06
1766 #define GB_LIGHTS_TYPE_SET_BLINK 0x07
1767 #define GB_LIGHTS_TYPE_SET_COLOR 0x08
1768 #define GB_LIGHTS_TYPE_SET_FADE 0x09
1769 #define GB_LIGHTS_TYPE_EVENT 0x0A
1770 #define GB_LIGHTS_TYPE_SET_FLASH_INTENSITY 0x0B
1771 #define GB_LIGHTS_TYPE_SET_FLASH_STROBE 0x0C
1772 #define GB_LIGHTS_TYPE_SET_FLASH_TIMEOUT 0x0D
1773 #define GB_LIGHTS_TYPE_GET_FLASH_FAULT 0x0E
1775 /* Greybus Light modes */
1778 * if you add any specific mode below, update also the
1779 * GB_CHANNEL_MODE_DEFINED_RANGE value accordingly
1781 #define GB_CHANNEL_MODE_NONE 0x00000000
1782 #define GB_CHANNEL_MODE_BATTERY 0x00000001
1783 #define GB_CHANNEL_MODE_POWER 0x00000002
1784 #define GB_CHANNEL_MODE_WIRELESS 0x00000004
1785 #define GB_CHANNEL_MODE_BLUETOOTH 0x00000008
1786 #define GB_CHANNEL_MODE_KEYBOARD 0x00000010
1787 #define GB_CHANNEL_MODE_BUTTONS 0x00000020
1788 #define GB_CHANNEL_MODE_NOTIFICATION 0x00000040
1789 #define GB_CHANNEL_MODE_ATTENTION 0x00000080
1790 #define GB_CHANNEL_MODE_FLASH 0x00000100
1791 #define GB_CHANNEL_MODE_TORCH 0x00000200
1792 #define GB_CHANNEL_MODE_INDICATOR 0x00000400
1794 /* Lights Mode valid bit values */
1795 #define GB_CHANNEL_MODE_DEFINED_RANGE 0x000004FF
1796 #define GB_CHANNEL_MODE_VENDOR_RANGE 0x00F00000
1798 /* Greybus Light Channels Flags */
1799 #define GB_LIGHT_CHANNEL_MULTICOLOR 0x00000001
1800 #define GB_LIGHT_CHANNEL_FADER 0x00000002
1801 #define GB_LIGHT_CHANNEL_BLINK 0x00000004
1803 /* get count of lights in module */
1804 struct gb_lights_get_lights_response {
1805 __u8 lights_count;
1806 } __packed;
1808 /* light config request payload */
1809 struct gb_lights_get_light_config_request {
1810 __u8 id;
1811 } __packed;
1813 /* light config response payload */
1814 struct gb_lights_get_light_config_response {
1815 __u8 channel_count;
1816 __u8 name[32];
1817 } __packed;
1819 /* channel config request payload */
1820 struct gb_lights_get_channel_config_request {
1821 __u8 light_id;
1822 __u8 channel_id;
1823 } __packed;
1825 /* channel flash config request payload */
1826 struct gb_lights_get_channel_flash_config_request {
1827 __u8 light_id;
1828 __u8 channel_id;
1829 } __packed;
1831 /* channel config response payload */
1832 struct gb_lights_get_channel_config_response {
1833 __u8 max_brightness;
1834 __le32 flags;
1835 __le32 color;
1836 __u8 color_name[32];
1837 __le32 mode;
1838 __u8 mode_name[32];
1839 } __packed;
1841 /* channel flash config response payload */
1842 struct gb_lights_get_channel_flash_config_response {
1843 __le32 intensity_min_uA;
1844 __le32 intensity_max_uA;
1845 __le32 intensity_step_uA;
1846 __le32 timeout_min_us;
1847 __le32 timeout_max_us;
1848 __le32 timeout_step_us;
1849 } __packed;
1851 /* blink request payload: response have no payload */
1852 struct gb_lights_blink_request {
1853 __u8 light_id;
1854 __u8 channel_id;
1855 __le16 time_on_ms;
1856 __le16 time_off_ms;
1857 } __packed;
1859 /* set brightness request payload: response have no payload */
1860 struct gb_lights_set_brightness_request {
1861 __u8 light_id;
1862 __u8 channel_id;
1863 __u8 brightness;
1864 } __packed;
1866 /* set color request payload: response have no payload */
1867 struct gb_lights_set_color_request {
1868 __u8 light_id;
1869 __u8 channel_id;
1870 __le32 color;
1871 } __packed;
1873 /* set fade request payload: response have no payload */
1874 struct gb_lights_set_fade_request {
1875 __u8 light_id;
1876 __u8 channel_id;
1877 __u8 fade_in;
1878 __u8 fade_out;
1879 } __packed;
1881 /* event request: generated by module */
1882 struct gb_lights_event_request {
1883 __u8 light_id;
1884 __u8 event;
1885 #define GB_LIGHTS_LIGHT_CONFIG 0x01
1886 } __packed;
1888 /* set flash intensity request payload: response have no payload */
1889 struct gb_lights_set_flash_intensity_request {
1890 __u8 light_id;
1891 __u8 channel_id;
1892 __le32 intensity_uA;
1893 } __packed;
1895 /* set flash strobe state request payload: response have no payload */
1896 struct gb_lights_set_flash_strobe_request {
1897 __u8 light_id;
1898 __u8 channel_id;
1899 __u8 state;
1900 } __packed;
1902 /* set flash timeout request payload: response have no payload */
1903 struct gb_lights_set_flash_timeout_request {
1904 __u8 light_id;
1905 __u8 channel_id;
1906 __le32 timeout_us;
1907 } __packed;
1909 /* get flash fault request payload */
1910 struct gb_lights_get_flash_fault_request {
1911 __u8 light_id;
1912 __u8 channel_id;
1913 } __packed;
1915 /* get flash fault response payload */
1916 struct gb_lights_get_flash_fault_response {
1917 __le32 fault;
1918 #define GB_LIGHTS_FLASH_FAULT_OVER_VOLTAGE 0x00000000
1919 #define GB_LIGHTS_FLASH_FAULT_TIMEOUT 0x00000001
1920 #define GB_LIGHTS_FLASH_FAULT_OVER_TEMPERATURE 0x00000002
1921 #define GB_LIGHTS_FLASH_FAULT_SHORT_CIRCUIT 0x00000004
1922 #define GB_LIGHTS_FLASH_FAULT_OVER_CURRENT 0x00000008
1923 #define GB_LIGHTS_FLASH_FAULT_INDICATOR 0x00000010
1924 #define GB_LIGHTS_FLASH_FAULT_UNDER_VOLTAGE 0x00000020
1925 #define GB_LIGHTS_FLASH_FAULT_INPUT_VOLTAGE 0x00000040
1926 #define GB_LIGHTS_FLASH_FAULT_LED_OVER_TEMPERATURE 0x00000080
1927 } __packed;
1929 /* Audio */
1931 #define GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE 0x02
1932 #define GB_AUDIO_TYPE_GET_TOPOLOGY 0x03
1933 #define GB_AUDIO_TYPE_GET_CONTROL 0x04
1934 #define GB_AUDIO_TYPE_SET_CONTROL 0x05
1935 #define GB_AUDIO_TYPE_ENABLE_WIDGET 0x06
1936 #define GB_AUDIO_TYPE_DISABLE_WIDGET 0x07
1937 #define GB_AUDIO_TYPE_GET_PCM 0x08
1938 #define GB_AUDIO_TYPE_SET_PCM 0x09
1939 #define GB_AUDIO_TYPE_SET_TX_DATA_SIZE 0x0a
1940 #define GB_AUDIO_TYPE_GET_TX_DELAY 0x0b
1941 #define GB_AUDIO_TYPE_ACTIVATE_TX 0x0c
1942 #define GB_AUDIO_TYPE_DEACTIVATE_TX 0x0d
1943 #define GB_AUDIO_TYPE_SET_RX_DATA_SIZE 0x0e
1944 #define GB_AUDIO_TYPE_GET_RX_DELAY 0x0f
1945 #define GB_AUDIO_TYPE_ACTIVATE_RX 0x10
1946 #define GB_AUDIO_TYPE_DEACTIVATE_RX 0x11
1947 #define GB_AUDIO_TYPE_JACK_EVENT 0x12
1948 #define GB_AUDIO_TYPE_BUTTON_EVENT 0x13
1949 #define GB_AUDIO_TYPE_STREAMING_EVENT 0x14
1950 #define GB_AUDIO_TYPE_SEND_DATA 0x15
1952 /* Module must be able to buffer 10ms of audio data, minimum */
1953 #define GB_AUDIO_SAMPLE_BUFFER_MIN_US 10000
1955 #define GB_AUDIO_PCM_NAME_MAX 32
1956 #define AUDIO_DAI_NAME_MAX 32
1957 #define AUDIO_CONTROL_NAME_MAX 32
1958 #define AUDIO_CTL_ELEM_NAME_MAX 44
1959 #define AUDIO_ENUM_NAME_MAX 64
1960 #define AUDIO_WIDGET_NAME_MAX 32
1962 /* See SNDRV_PCM_FMTBIT_* in Linux source */
1963 #define GB_AUDIO_PCM_FMT_S8 BIT(0)
1964 #define GB_AUDIO_PCM_FMT_U8 BIT(1)
1965 #define GB_AUDIO_PCM_FMT_S16_LE BIT(2)
1966 #define GB_AUDIO_PCM_FMT_S16_BE BIT(3)
1967 #define GB_AUDIO_PCM_FMT_U16_LE BIT(4)
1968 #define GB_AUDIO_PCM_FMT_U16_BE BIT(5)
1969 #define GB_AUDIO_PCM_FMT_S24_LE BIT(6)
1970 #define GB_AUDIO_PCM_FMT_S24_BE BIT(7)
1971 #define GB_AUDIO_PCM_FMT_U24_LE BIT(8)
1972 #define GB_AUDIO_PCM_FMT_U24_BE BIT(9)
1973 #define GB_AUDIO_PCM_FMT_S32_LE BIT(10)
1974 #define GB_AUDIO_PCM_FMT_S32_BE BIT(11)
1975 #define GB_AUDIO_PCM_FMT_U32_LE BIT(12)
1976 #define GB_AUDIO_PCM_FMT_U32_BE BIT(13)
1978 /* See SNDRV_PCM_RATE_* in Linux source */
1979 #define GB_AUDIO_PCM_RATE_5512 BIT(0)
1980 #define GB_AUDIO_PCM_RATE_8000 BIT(1)
1981 #define GB_AUDIO_PCM_RATE_11025 BIT(2)
1982 #define GB_AUDIO_PCM_RATE_16000 BIT(3)
1983 #define GB_AUDIO_PCM_RATE_22050 BIT(4)
1984 #define GB_AUDIO_PCM_RATE_32000 BIT(5)
1985 #define GB_AUDIO_PCM_RATE_44100 BIT(6)
1986 #define GB_AUDIO_PCM_RATE_48000 BIT(7)
1987 #define GB_AUDIO_PCM_RATE_64000 BIT(8)
1988 #define GB_AUDIO_PCM_RATE_88200 BIT(9)
1989 #define GB_AUDIO_PCM_RATE_96000 BIT(10)
1990 #define GB_AUDIO_PCM_RATE_176400 BIT(11)
1991 #define GB_AUDIO_PCM_RATE_192000 BIT(12)
1993 #define GB_AUDIO_STREAM_TYPE_CAPTURE 0x1
1994 #define GB_AUDIO_STREAM_TYPE_PLAYBACK 0x2
1996 #define GB_AUDIO_CTL_ELEM_ACCESS_READ BIT(0)
1997 #define GB_AUDIO_CTL_ELEM_ACCESS_WRITE BIT(1)
1999 /* See SNDRV_CTL_ELEM_TYPE_* in Linux source */
2000 #define GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN 0x01
2001 #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER 0x02
2002 #define GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED 0x03
2003 #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER64 0x06
2005 /* See SNDRV_CTL_ELEM_IFACE_* in Linux source */
2006 #define GB_AUDIO_CTL_ELEM_IFACE_CARD 0x00
2007 #define GB_AUDIO_CTL_ELEM_IFACE_HWDEP 0x01
2008 #define GB_AUDIO_CTL_ELEM_IFACE_MIXER 0x02
2009 #define GB_AUDIO_CTL_ELEM_IFACE_PCM 0x03
2010 #define GB_AUDIO_CTL_ELEM_IFACE_RAWMIDI 0x04
2011 #define GB_AUDIO_CTL_ELEM_IFACE_TIMER 0x05
2012 #define GB_AUDIO_CTL_ELEM_IFACE_SEQUENCER 0x06
2014 /* SNDRV_CTL_ELEM_ACCESS_* in Linux source */
2015 #define GB_AUDIO_ACCESS_READ BIT(0)
2016 #define GB_AUDIO_ACCESS_WRITE BIT(1)
2017 #define GB_AUDIO_ACCESS_VOLATILE BIT(2)
2018 #define GB_AUDIO_ACCESS_TIMESTAMP BIT(3)
2019 #define GB_AUDIO_ACCESS_TLV_READ BIT(4)
2020 #define GB_AUDIO_ACCESS_TLV_WRITE BIT(5)
2021 #define GB_AUDIO_ACCESS_TLV_COMMAND BIT(6)
2022 #define GB_AUDIO_ACCESS_INACTIVE BIT(7)
2023 #define GB_AUDIO_ACCESS_LOCK BIT(8)
2024 #define GB_AUDIO_ACCESS_OWNER BIT(9)
2026 /* enum snd_soc_dapm_type */
2027 #define GB_AUDIO_WIDGET_TYPE_INPUT 0x0
2028 #define GB_AUDIO_WIDGET_TYPE_OUTPUT 0x1
2029 #define GB_AUDIO_WIDGET_TYPE_MUX 0x2
2030 #define GB_AUDIO_WIDGET_TYPE_VIRT_MUX 0x3
2031 #define GB_AUDIO_WIDGET_TYPE_VALUE_MUX 0x4
2032 #define GB_AUDIO_WIDGET_TYPE_MIXER 0x5
2033 #define GB_AUDIO_WIDGET_TYPE_MIXER_NAMED_CTL 0x6
2034 #define GB_AUDIO_WIDGET_TYPE_PGA 0x7
2035 #define GB_AUDIO_WIDGET_TYPE_OUT_DRV 0x8
2036 #define GB_AUDIO_WIDGET_TYPE_ADC 0x9
2037 #define GB_AUDIO_WIDGET_TYPE_DAC 0xa
2038 #define GB_AUDIO_WIDGET_TYPE_MICBIAS 0xb
2039 #define GB_AUDIO_WIDGET_TYPE_MIC 0xc
2040 #define GB_AUDIO_WIDGET_TYPE_HP 0xd
2041 #define GB_AUDIO_WIDGET_TYPE_SPK 0xe
2042 #define GB_AUDIO_WIDGET_TYPE_LINE 0xf
2043 #define GB_AUDIO_WIDGET_TYPE_SWITCH 0x10
2044 #define GB_AUDIO_WIDGET_TYPE_VMID 0x11
2045 #define GB_AUDIO_WIDGET_TYPE_PRE 0x12
2046 #define GB_AUDIO_WIDGET_TYPE_POST 0x13
2047 #define GB_AUDIO_WIDGET_TYPE_SUPPLY 0x14
2048 #define GB_AUDIO_WIDGET_TYPE_REGULATOR_SUPPLY 0x15
2049 #define GB_AUDIO_WIDGET_TYPE_CLOCK_SUPPLY 0x16
2050 #define GB_AUDIO_WIDGET_TYPE_AIF_IN 0x17
2051 #define GB_AUDIO_WIDGET_TYPE_AIF_OUT 0x18
2052 #define GB_AUDIO_WIDGET_TYPE_SIGGEN 0x19
2053 #define GB_AUDIO_WIDGET_TYPE_DAI_IN 0x1a
2054 #define GB_AUDIO_WIDGET_TYPE_DAI_OUT 0x1b
2055 #define GB_AUDIO_WIDGET_TYPE_DAI_LINK 0x1c
2057 #define GB_AUDIO_WIDGET_STATE_DISABLED 0x01
2058 #define GB_AUDIO_WIDGET_STATE_ENAABLED 0x02
2060 #define GB_AUDIO_JACK_EVENT_INSERTION 0x1
2061 #define GB_AUDIO_JACK_EVENT_REMOVAL 0x2
2063 #define GB_AUDIO_BUTTON_EVENT_PRESS 0x1
2064 #define GB_AUDIO_BUTTON_EVENT_RELEASE 0x2
2066 #define GB_AUDIO_STREAMING_EVENT_UNSPECIFIED 0x1
2067 #define GB_AUDIO_STREAMING_EVENT_HALT 0x2
2068 #define GB_AUDIO_STREAMING_EVENT_INTERNAL_ERROR 0x3
2069 #define GB_AUDIO_STREAMING_EVENT_PROTOCOL_ERROR 0x4
2070 #define GB_AUDIO_STREAMING_EVENT_FAILURE 0x5
2071 #define GB_AUDIO_STREAMING_EVENT_UNDERRUN 0x6
2072 #define GB_AUDIO_STREAMING_EVENT_OVERRUN 0x7
2073 #define GB_AUDIO_STREAMING_EVENT_CLOCKING 0x8
2074 #define GB_AUDIO_STREAMING_EVENT_DATA_LEN 0x9
2076 #define GB_AUDIO_INVALID_INDEX 0xff
2078 struct gb_audio_pcm {
2079 __u8 stream_name[GB_AUDIO_PCM_NAME_MAX];
2080 __le32 formats; /* GB_AUDIO_PCM_FMT_* */
2081 __le32 rates; /* GB_AUDIO_PCM_RATE_* */
2082 __u8 chan_min;
2083 __u8 chan_max;
2084 __u8 sig_bits; /* number of bits of content */
2085 } __packed;
2087 struct gb_audio_dai {
2088 __u8 name[AUDIO_DAI_NAME_MAX];
2089 __le16 data_cport;
2090 struct gb_audio_pcm capture;
2091 struct gb_audio_pcm playback;
2092 } __packed;
2094 struct gb_audio_integer {
2095 __le32 min;
2096 __le32 max;
2097 __le32 step;
2098 } __packed;
2100 struct gb_audio_integer64 {
2101 __le64 min;
2102 __le64 max;
2103 __le64 step;
2104 } __packed;
2106 struct gb_audio_enumerated {
2107 __le32 items;
2108 __le16 names_length;
2109 __u8 names[0];
2110 } __packed;
2112 struct gb_audio_ctl_elem_info { /* See snd_ctl_elem_info in Linux source */
2113 __u8 type; /* GB_AUDIO_CTL_ELEM_TYPE_* */
2114 __le16 dimen[4];
2115 union {
2116 struct gb_audio_integer integer;
2117 struct gb_audio_integer64 integer64;
2118 struct gb_audio_enumerated enumerated;
2119 } value;
2120 } __packed;
2122 struct gb_audio_ctl_elem_value { /* See snd_ctl_elem_value in Linux source */
2123 __le64 timestamp; /* XXX needed? */
2124 union {
2125 __le32 integer_value[2]; /* consider CTL_DOUBLE_xxx */
2126 __le64 integer64_value[2];
2127 __le32 enumerated_item[2];
2128 } value;
2129 } __packed;
2131 struct gb_audio_control {
2132 __u8 name[AUDIO_CONTROL_NAME_MAX];
2133 __u8 id; /* 0-63 */
2134 __u8 iface; /* GB_AUDIO_IFACE_* */
2135 __le16 data_cport;
2136 __le32 access; /* GB_AUDIO_ACCESS_* */
2137 __u8 count; /* count of same elements */
2138 __u8 count_values; /* count of values, max=2 for CTL_DOUBLE_xxx */
2139 struct gb_audio_ctl_elem_info info;
2140 } __packed;
2142 struct gb_audio_widget {
2143 __u8 name[AUDIO_WIDGET_NAME_MAX];
2144 __u8 sname[AUDIO_WIDGET_NAME_MAX];
2145 __u8 id;
2146 __u8 type; /* GB_AUDIO_WIDGET_TYPE_* */
2147 __u8 state; /* GB_AUDIO_WIDGET_STATE_* */
2148 __u8 ncontrols;
2149 struct gb_audio_control ctl[0]; /* 'ncontrols' entries */
2150 } __packed;
2152 struct gb_audio_route {
2153 __u8 source_id; /* widget id */
2154 __u8 destination_id; /* widget id */
2155 __u8 control_id; /* 0-63 */
2156 __u8 index; /* Selection within the control */
2157 } __packed;
2159 struct gb_audio_topology {
2160 __u8 num_dais;
2161 __u8 num_controls;
2162 __u8 num_widgets;
2163 __u8 num_routes;
2164 __u32 size_dais;
2165 __u32 size_controls;
2166 __u32 size_widgets;
2167 __u32 size_routes;
2169 * struct gb_audio_dai dai[num_dais];
2170 * struct gb_audio_control controls[num_controls];
2171 * struct gb_audio_widget widgets[num_widgets];
2172 * struct gb_audio_route routes[num_routes];
2174 __u8 data[0];
2175 } __packed;
2177 struct gb_audio_get_topology_size_response {
2178 __le16 size;
2179 } __packed;
2181 struct gb_audio_get_topology_response {
2182 struct gb_audio_topology topology;
2183 } __packed;
2185 struct gb_audio_get_control_request {
2186 __u8 control_id;
2187 __u8 index;
2188 } __packed;
2190 struct gb_audio_get_control_response {
2191 struct gb_audio_ctl_elem_value value;
2192 } __packed;
2194 struct gb_audio_set_control_request {
2195 __u8 control_id;
2196 __u8 index;
2197 struct gb_audio_ctl_elem_value value;
2198 } __packed;
2200 struct gb_audio_enable_widget_request {
2201 __u8 widget_id;
2202 } __packed;
2204 struct gb_audio_disable_widget_request {
2205 __u8 widget_id;
2206 } __packed;
2208 struct gb_audio_get_pcm_request {
2209 __le16 data_cport;
2210 } __packed;
2212 struct gb_audio_get_pcm_response {
2213 __le32 format;
2214 __le32 rate;
2215 __u8 channels;
2216 __u8 sig_bits;
2217 } __packed;
2219 struct gb_audio_set_pcm_request {
2220 __le16 data_cport;
2221 __le32 format;
2222 __le32 rate;
2223 __u8 channels;
2224 __u8 sig_bits;
2225 } __packed;
2227 struct gb_audio_set_tx_data_size_request {
2228 __le16 data_cport;
2229 __le16 size;
2230 } __packed;
2232 struct gb_audio_get_tx_delay_request {
2233 __le16 data_cport;
2234 } __packed;
2236 struct gb_audio_get_tx_delay_response {
2237 __le32 delay;
2238 } __packed;
2240 struct gb_audio_activate_tx_request {
2241 __le16 data_cport;
2242 } __packed;
2244 struct gb_audio_deactivate_tx_request {
2245 __le16 data_cport;
2246 } __packed;
2248 struct gb_audio_set_rx_data_size_request {
2249 __le16 data_cport;
2250 __le16 size;
2251 } __packed;
2253 struct gb_audio_get_rx_delay_request {
2254 __le16 data_cport;
2255 } __packed;
2257 struct gb_audio_get_rx_delay_response {
2258 __le32 delay;
2259 } __packed;
2261 struct gb_audio_activate_rx_request {
2262 __le16 data_cport;
2263 } __packed;
2265 struct gb_audio_deactivate_rx_request {
2266 __le16 data_cport;
2267 } __packed;
2269 struct gb_audio_jack_event_request {
2270 __u8 widget_id;
2271 __u8 jack_attribute;
2272 __u8 event;
2273 } __packed;
2275 struct gb_audio_button_event_request {
2276 __u8 widget_id;
2277 __u8 button_id;
2278 __u8 event;
2279 } __packed;
2281 struct gb_audio_streaming_event_request {
2282 __le16 data_cport;
2283 __u8 event;
2284 } __packed;
2286 struct gb_audio_send_data_request {
2287 __le64 timestamp;
2288 __u8 data[0];
2289 } __packed;
2292 /* Log */
2294 /* operations */
2295 #define GB_LOG_TYPE_SEND_LOG 0x02
2297 /* length */
2298 #define GB_LOG_MAX_LEN 1024
2300 struct gb_log_send_log_request {
2301 __le16 len;
2302 __u8 msg[0];
2303 } __packed;
2305 #endif /* __GREYBUS_PROTOCOLS_H */