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.
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.
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
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
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
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
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) */
98 /* Generic request types */
99 #define GB_REQUEST_TYPE_PING 0x00
100 #define GB_REQUEST_TYPE_PROTOCOL_VERSION 0x01
101 #define GB_REQUEST_TYPE_INVALID 0x7f
103 struct gb_protocol_version_request {
108 struct gb_protocol_version_response {
113 /* Control Protocol */
115 /* Greybus control request types */
116 #define GB_CONTROL_TYPE_VERSION 0x01
117 #define GB_CONTROL_TYPE_PROBE_AP 0x02
118 #define GB_CONTROL_TYPE_GET_MANIFEST_SIZE 0x03
119 #define GB_CONTROL_TYPE_GET_MANIFEST 0x04
120 #define GB_CONTROL_TYPE_CONNECTED 0x05
121 #define GB_CONTROL_TYPE_DISCONNECTED 0x06
122 #define GB_CONTROL_TYPE_TIMESYNC_ENABLE 0x07
123 #define GB_CONTROL_TYPE_TIMESYNC_DISABLE 0x08
124 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
126 #define GB_CONTROL_TYPE_BUNDLE_VERSION 0x0b
127 #define GB_CONTROL_TYPE_DISCONNECTING 0x0c
128 #define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT 0x0d
129 #define GB_CONTROL_TYPE_MODE_SWITCH 0x0e
131 struct gb_control_version_request {
136 struct gb_control_version_response {
141 struct gb_control_bundle_version_request {
145 struct gb_control_bundle_version_response {
150 /* Control protocol manifest get size request has no payload*/
151 struct gb_control_get_manifest_size_response {
155 /* Control protocol manifest get request has no payload */
156 struct gb_control_get_manifest_response {
160 /* Control protocol [dis]connected request */
161 struct gb_control_connected_request {
165 struct gb_control_disconnecting_request {
168 /* disconnecting response has no payload */
170 struct gb_control_disconnected_request {
173 /* Control protocol [dis]connected response has no payload */
175 #define GB_TIMESYNC_MAX_STROBES 0x04
177 struct gb_control_timesync_enable_request {
183 /* timesync enable response has no payload */
185 struct gb_control_timesync_authoritative_request {
186 __le64 frame_time[GB_TIMESYNC_MAX_STROBES];
188 /* timesync authoritative response has no payload */
190 /* timesync get_last_event_request has no payload */
191 struct gb_control_timesync_get_last_event_response {
195 /* APBridge protocol */
197 /* request APB1 log */
198 #define GB_APB_REQUEST_LOG 0x02
200 /* request to map a cport to bulk in and bulk out endpoints */
201 #define GB_APB_REQUEST_EP_MAPPING 0x03
203 /* request to get the number of cports available */
204 #define GB_APB_REQUEST_CPORT_COUNT 0x04
206 /* request to reset a cport state */
207 #define GB_APB_REQUEST_RESET_CPORT 0x05
209 /* request to time the latency of messages on a given cport */
210 #define GB_APB_REQUEST_LATENCY_TAG_EN 0x06
211 #define GB_APB_REQUEST_LATENCY_TAG_DIS 0x07
213 /* request to control the CSI transmitter */
214 #define GB_APB_REQUEST_CSI_TX_CONTROL 0x08
216 /* request to control the CSI transmitter */
217 #define GB_APB_REQUEST_AUDIO_CONTROL 0x09
219 /* vendor requests to enable/disable CPort features */
220 #define GB_APB_REQUEST_CPORT_FEAT_EN 0x0b
221 #define GB_APB_REQUEST_CPORT_FEAT_DIS 0x0c
223 /* TimeSync commands */
224 #define REQUEST_TIMESYNC_ENABLE 0x0d
225 #define REQUEST_TIMESYNC_DISABLE 0x0e
226 #define REQUEST_TIMESYNC_AUTHORITATIVE 0x0f
227 #define REQUEST_TIMESYNC_GET_LAST_EVENT 0x10
229 /* Firmware Download Protocol */
232 #define GB_FW_DOWNLOAD_TYPE_FIND_FIRMWARE 0x01
233 #define GB_FW_DOWNLOAD_TYPE_FETCH_FIRMWARE 0x02
234 #define GB_FW_DOWNLOAD_TYPE_RELEASE_FIRMWARE 0x03
236 #define GB_FIRMWARE_TAG_MAX_LEN 10
238 /* firmware download find firmware request/response */
239 struct gb_fw_download_find_firmware_request {
240 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
243 struct gb_fw_download_find_firmware_response {
248 /* firmware download fetch firmware request/response */
249 struct gb_fw_download_fetch_firmware_request {
255 struct gb_fw_download_fetch_firmware_response {
259 /* firmware download release firmware request */
260 struct gb_fw_download_release_firmware_request {
263 /* firmware download release firmware response has no payload */
266 /* Firmware Management Protocol */
269 #define GB_FW_MGMT_TYPE_INTERFACE_FW_VERSION 0x01
270 #define GB_FW_MGMT_TYPE_LOAD_AND_VALIDATE_FW 0x02
271 #define GB_FW_MGMT_TYPE_LOADED_FW 0x03
272 #define GB_FW_MGMT_TYPE_BACKEND_FW_VERSION 0x04
273 #define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATE 0x05
274 #define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATED 0x06
276 #define GB_FW_LOAD_METHOD_UNIPRO 0x01
277 #define GB_FW_LOAD_METHOD_INTERNAL 0x02
279 #define GB_FW_LOAD_STATUS_FAILED 0x00
280 #define GB_FW_LOAD_STATUS_UNVALIDATED 0x01
281 #define GB_FW_LOAD_STATUS_VALIDATED 0x02
282 #define GB_FW_LOAD_STATUS_VALIDATION_FAILED 0x03
284 #define GB_FW_BACKEND_FW_STATUS_SUCCESS 0x01
285 #define GB_FW_BACKEND_FW_STATUS_FAIL_FIND 0x02
286 #define GB_FW_BACKEND_FW_STATUS_FAIL_FETCH 0x03
287 #define GB_FW_BACKEND_FW_STATUS_FAIL_WRITE 0x04
288 #define GB_FW_BACKEND_FW_STATUS_INT 0x05
290 /* firmware management interface firmware version request has no payload */
291 struct gb_fw_mgmt_interface_fw_version_response {
292 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
297 /* firmware management load and validate firmware request/response */
298 struct gb_fw_mgmt_load_and_validate_fw_request {
301 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
303 /* firmware management load and validate firmware response has no payload*/
305 /* firmware management loaded firmware request */
306 struct gb_fw_mgmt_loaded_fw_request {
312 /* firmware management loaded firmware response has no payload */
314 /* firmware management backend firmware version request/response */
315 struct gb_fw_mgmt_backend_fw_version_request {
316 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
319 struct gb_fw_mgmt_backend_fw_version_response {
324 /* firmware management backend firmware update request */
325 struct gb_fw_mgmt_backend_fw_update_request {
327 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_LEN];
329 /* firmware management backend firmware update response has no payload */
331 /* firmware management backend firmware updated request */
332 struct gb_fw_mgmt_backend_fw_updated_request {
336 /* firmware management backend firmware updated response has no payload */
339 /* Bootrom Protocol */
341 /* Version of the Greybus bootrom protocol we support */
342 #define GB_BOOTROM_VERSION_MAJOR 0x00
343 #define GB_BOOTROM_VERSION_MINOR 0x01
345 /* Greybus bootrom request types */
346 #define GB_BOOTROM_TYPE_VERSION 0x01
347 #define GB_BOOTROM_TYPE_FIRMWARE_SIZE 0x02
348 #define GB_BOOTROM_TYPE_GET_FIRMWARE 0x03
349 #define GB_BOOTROM_TYPE_READY_TO_BOOT 0x04
350 #define GB_BOOTROM_TYPE_AP_READY 0x05 /* Request with no-payload */
351 #define GB_BOOTROM_TYPE_GET_VID_PID 0x06 /* Request with no-payload */
353 /* Greybus bootrom boot stages */
354 #define GB_BOOTROM_BOOT_STAGE_ONE 0x01 /* Reserved for the boot ROM */
355 #define GB_BOOTROM_BOOT_STAGE_TWO 0x02 /* Bootrom package to be loaded by the boot ROM */
356 #define GB_BOOTROM_BOOT_STAGE_THREE 0x03 /* Module personality package loaded by Stage 2 firmware */
358 /* Greybus bootrom ready to boot status */
359 #define GB_BOOTROM_BOOT_STATUS_INVALID 0x00 /* Firmware blob could not be validated */
360 #define GB_BOOTROM_BOOT_STATUS_INSECURE 0x01 /* Firmware blob is valid but insecure */
361 #define GB_BOOTROM_BOOT_STATUS_SECURE 0x02 /* Firmware blob is valid and secure */
363 /* Max bootrom data fetch size in bytes */
364 #define GB_BOOTROM_FETCH_MAX 2000
366 struct gb_bootrom_version_request {
371 struct gb_bootrom_version_response {
376 /* Bootrom protocol firmware size request/response */
377 struct gb_bootrom_firmware_size_request {
381 struct gb_bootrom_firmware_size_response {
385 /* Bootrom protocol get firmware request/response */
386 struct gb_bootrom_get_firmware_request {
391 struct gb_bootrom_get_firmware_response {
395 /* Bootrom protocol Ready to boot request */
396 struct gb_bootrom_ready_to_boot_request {
399 /* Bootrom protocol Ready to boot response has no payload */
401 /* Bootrom protocol get VID/PID request has no payload */
402 struct gb_bootrom_get_vid_pid_response {
410 /* Version of the Greybus power supply protocol we support */
411 #define GB_POWER_SUPPLY_VERSION_MAJOR 0x00
412 #define GB_POWER_SUPPLY_VERSION_MINOR 0x01
414 /* Greybus power supply request types */
415 #define GB_POWER_SUPPLY_TYPE_GET_SUPPLIES 0x02
416 #define GB_POWER_SUPPLY_TYPE_GET_DESCRIPTION 0x03
417 #define GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS 0x04
418 #define GB_POWER_SUPPLY_TYPE_GET_PROPERTY 0x05
419 #define GB_POWER_SUPPLY_TYPE_SET_PROPERTY 0x06
420 #define GB_POWER_SUPPLY_TYPE_EVENT 0x07
422 /* Should match up with battery technologies in linux/power_supply.h */
423 #define GB_POWER_SUPPLY_TECH_UNKNOWN 0x0000
424 #define GB_POWER_SUPPLY_TECH_NiMH 0x0001
425 #define GB_POWER_SUPPLY_TECH_LION 0x0002
426 #define GB_POWER_SUPPLY_TECH_LIPO 0x0003
427 #define GB_POWER_SUPPLY_TECH_LiFe 0x0004
428 #define GB_POWER_SUPPLY_TECH_NiCd 0x0005
429 #define GB_POWER_SUPPLY_TECH_LiMn 0x0006
431 /* Should match up with power supply types in linux/power_supply.h */
432 #define GB_POWER_SUPPLY_UNKNOWN_TYPE 0x0000
433 #define GB_POWER_SUPPLY_BATTERY_TYPE 0x0001
434 #define GB_POWER_SUPPLY_UPS_TYPE 0x0002
435 #define GB_POWER_SUPPLY_MAINS_TYPE 0x0003
436 #define GB_POWER_SUPPLY_USB_TYPE 0x0004
437 #define GB_POWER_SUPPLY_USB_DCP_TYPE 0x0005
438 #define GB_POWER_SUPPLY_USB_CDP_TYPE 0x0006
439 #define GB_POWER_SUPPLY_USB_ACA_TYPE 0x0007
441 /* Should match up with power supply health in linux/power_supply.h */
442 #define GB_POWER_SUPPLY_HEALTH_UNKNOWN 0x0000
443 #define GB_POWER_SUPPLY_HEALTH_GOOD 0x0001
444 #define GB_POWER_SUPPLY_HEALTH_OVERHEAT 0x0002
445 #define GB_POWER_SUPPLY_HEALTH_DEAD 0x0003
446 #define GB_POWER_SUPPLY_HEALTH_OVERVOLTAGE 0x0004
447 #define GB_POWER_SUPPLY_HEALTH_UNSPEC_FAILURE 0x0005
448 #define GB_POWER_SUPPLY_HEALTH_COLD 0x0006
449 #define GB_POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE 0x0007
450 #define GB_POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE 0x0008
452 /* Should match up with battery status in linux/power_supply.h */
453 #define GB_POWER_SUPPLY_STATUS_UNKNOWN 0x0000
454 #define GB_POWER_SUPPLY_STATUS_CHARGING 0x0001
455 #define GB_POWER_SUPPLY_STATUS_DISCHARGING 0x0002
456 #define GB_POWER_SUPPLY_STATUS_NOT_CHARGING 0x0003
457 #define GB_POWER_SUPPLY_STATUS_FULL 0x0004
459 struct gb_power_supply_get_supplies_response {
463 struct gb_power_supply_get_description_request {
467 struct gb_power_supply_get_description_response {
468 __u8 manufacturer[32];
470 __u8 serial_number[32];
472 __u8 properties_count;
475 struct gb_power_supply_props_desc {
477 #define GB_POWER_SUPPLY_PROP_STATUS 0x00
478 #define GB_POWER_SUPPLY_PROP_CHARGE_TYPE 0x01
479 #define GB_POWER_SUPPLY_PROP_HEALTH 0x02
480 #define GB_POWER_SUPPLY_PROP_PRESENT 0x03
481 #define GB_POWER_SUPPLY_PROP_ONLINE 0x04
482 #define GB_POWER_SUPPLY_PROP_AUTHENTIC 0x05
483 #define GB_POWER_SUPPLY_PROP_TECHNOLOGY 0x06
484 #define GB_POWER_SUPPLY_PROP_CYCLE_COUNT 0x07
485 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX 0x08
486 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN 0x09
487 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN 0x0A
488 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN 0x0B
489 #define GB_POWER_SUPPLY_PROP_VOLTAGE_NOW 0x0C
490 #define GB_POWER_SUPPLY_PROP_VOLTAGE_AVG 0x0D
491 #define GB_POWER_SUPPLY_PROP_VOLTAGE_OCV 0x0E
492 #define GB_POWER_SUPPLY_PROP_VOLTAGE_BOOT 0x0F
493 #define GB_POWER_SUPPLY_PROP_CURRENT_MAX 0x10
494 #define GB_POWER_SUPPLY_PROP_CURRENT_NOW 0x11
495 #define GB_POWER_SUPPLY_PROP_CURRENT_AVG 0x12
496 #define GB_POWER_SUPPLY_PROP_CURRENT_BOOT 0x13
497 #define GB_POWER_SUPPLY_PROP_POWER_NOW 0x14
498 #define GB_POWER_SUPPLY_PROP_POWER_AVG 0x15
499 #define GB_POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN 0x16
500 #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN 0x17
501 #define GB_POWER_SUPPLY_PROP_CHARGE_FULL 0x18
502 #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY 0x19
503 #define GB_POWER_SUPPLY_PROP_CHARGE_NOW 0x1A
504 #define GB_POWER_SUPPLY_PROP_CHARGE_AVG 0x1B
505 #define GB_POWER_SUPPLY_PROP_CHARGE_COUNTER 0x1C
506 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT 0x1D
507 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX 0x1E
508 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE 0x1F
509 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX 0x20
510 #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT 0x21
511 #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX 0x22
512 #define GB_POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT 0x23
513 #define GB_POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN 0x24
514 #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN 0x25
515 #define GB_POWER_SUPPLY_PROP_ENERGY_FULL 0x26
516 #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY 0x27
517 #define GB_POWER_SUPPLY_PROP_ENERGY_NOW 0x28
518 #define GB_POWER_SUPPLY_PROP_ENERGY_AVG 0x29
519 #define GB_POWER_SUPPLY_PROP_CAPACITY 0x2A
520 #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN 0x2B
521 #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX 0x2C
522 #define GB_POWER_SUPPLY_PROP_CAPACITY_LEVEL 0x2D
523 #define GB_POWER_SUPPLY_PROP_TEMP 0x2E
524 #define GB_POWER_SUPPLY_PROP_TEMP_MAX 0x2F
525 #define GB_POWER_SUPPLY_PROP_TEMP_MIN 0x30
526 #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MIN 0x31
527 #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MAX 0x32
528 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT 0x33
529 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN 0x34
530 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX 0x35
531 #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW 0x36
532 #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG 0x37
533 #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_NOW 0x38
534 #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_AVG 0x39
535 #define GB_POWER_SUPPLY_PROP_TYPE 0x3A
536 #define GB_POWER_SUPPLY_PROP_SCOPE 0x3B
537 #define GB_POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT 0x3C
538 #define GB_POWER_SUPPLY_PROP_CALIBRATE 0x3D
542 struct gb_power_supply_get_property_descriptors_request {
546 struct gb_power_supply_get_property_descriptors_response {
547 __u8 properties_count;
548 struct gb_power_supply_props_desc props[];
551 struct gb_power_supply_get_property_request {
556 struct gb_power_supply_get_property_response {
560 struct gb_power_supply_set_property_request {
566 struct gb_power_supply_event_request {
569 #define GB_POWER_SUPPLY_UPDATE 0x01
575 /* Version of the Greybus hid protocol we support */
576 #define GB_HID_VERSION_MAJOR 0x00
577 #define GB_HID_VERSION_MINOR 0x01
579 /* Greybus HID operation types */
580 #define GB_HID_TYPE_GET_DESC 0x02
581 #define GB_HID_TYPE_GET_REPORT_DESC 0x03
582 #define GB_HID_TYPE_PWR_ON 0x04
583 #define GB_HID_TYPE_PWR_OFF 0x05
584 #define GB_HID_TYPE_GET_REPORT 0x06
585 #define GB_HID_TYPE_SET_REPORT 0x07
586 #define GB_HID_TYPE_IRQ_EVENT 0x08
589 #define GB_HID_INPUT_REPORT 0
590 #define GB_HID_OUTPUT_REPORT 1
591 #define GB_HID_FEATURE_REPORT 2
593 /* Different request/response structures */
594 /* HID get descriptor response */
595 struct gb_hid_desc_response {
597 __le16 wReportDescLength;
604 /* HID get report request/response */
605 struct gb_hid_get_report_request {
610 /* HID set report request */
611 struct gb_hid_set_report_request {
617 /* HID input report request, via interrupt pipe */
618 struct gb_hid_input_report_request {
625 /* Version of the Greybus i2c protocol we support */
626 #define GB_I2C_VERSION_MAJOR 0x00
627 #define GB_I2C_VERSION_MINOR 0x01
629 /* Greybus i2c request types */
630 #define GB_I2C_TYPE_FUNCTIONALITY 0x02
631 #define GB_I2C_TYPE_TRANSFER 0x05
633 /* functionality request has no payload */
634 struct gb_i2c_functionality_response {
635 __le32 functionality;
639 * Outgoing data immediately follows the op count and ops array.
640 * The data for each write (master -> slave) op in the array is sent
641 * in order, with no (e.g. pad) bytes separating them.
643 * Short reads cause the entire transfer request to fail So response
644 * payload consists only of bytes read, and the number of bytes is
645 * exactly what was specified in the corresponding op. Like
646 * outgoing data, the incoming data is in order and contiguous.
648 struct gb_i2c_transfer_op {
654 struct gb_i2c_transfer_request {
656 struct gb_i2c_transfer_op ops[0]; /* op_count of these */
658 struct gb_i2c_transfer_response {
659 __u8 data[0]; /* inbound data */
665 /* Version of the Greybus GPIO protocol we support */
666 #define GB_GPIO_VERSION_MAJOR 0x00
667 #define GB_GPIO_VERSION_MINOR 0x01
669 /* Greybus GPIO request types */
670 #define GB_GPIO_TYPE_LINE_COUNT 0x02
671 #define GB_GPIO_TYPE_ACTIVATE 0x03
672 #define GB_GPIO_TYPE_DEACTIVATE 0x04
673 #define GB_GPIO_TYPE_GET_DIRECTION 0x05
674 #define GB_GPIO_TYPE_DIRECTION_IN 0x06
675 #define GB_GPIO_TYPE_DIRECTION_OUT 0x07
676 #define GB_GPIO_TYPE_GET_VALUE 0x08
677 #define GB_GPIO_TYPE_SET_VALUE 0x09
678 #define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a
679 #define GB_GPIO_TYPE_IRQ_TYPE 0x0b
680 #define GB_GPIO_TYPE_IRQ_MASK 0x0c
681 #define GB_GPIO_TYPE_IRQ_UNMASK 0x0d
682 #define GB_GPIO_TYPE_IRQ_EVENT 0x0e
684 #define GB_GPIO_IRQ_TYPE_NONE 0x00
685 #define GB_GPIO_IRQ_TYPE_EDGE_RISING 0x01
686 #define GB_GPIO_IRQ_TYPE_EDGE_FALLING 0x02
687 #define GB_GPIO_IRQ_TYPE_EDGE_BOTH 0x03
688 #define GB_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04
689 #define GB_GPIO_IRQ_TYPE_LEVEL_LOW 0x08
691 /* line count request has no payload */
692 struct gb_gpio_line_count_response {
696 struct gb_gpio_activate_request {
699 /* activate response has no payload */
701 struct gb_gpio_deactivate_request {
704 /* deactivate response has no payload */
706 struct gb_gpio_get_direction_request {
709 struct gb_gpio_get_direction_response {
713 struct gb_gpio_direction_in_request {
716 /* direction in response has no payload */
718 struct gb_gpio_direction_out_request {
722 /* direction out response has no payload */
724 struct gb_gpio_get_value_request {
727 struct gb_gpio_get_value_response {
731 struct gb_gpio_set_value_request {
735 /* set value response has no payload */
737 struct gb_gpio_set_debounce_request {
741 /* debounce response has no payload */
743 struct gb_gpio_irq_type_request {
747 /* irq type response has no payload */
749 struct gb_gpio_irq_mask_request {
752 /* irq mask response has no payload */
754 struct gb_gpio_irq_unmask_request {
757 /* irq unmask response has no payload */
759 /* irq event requests originate on another module and are handled on the AP */
760 struct gb_gpio_irq_event_request {
763 /* irq event has no response */
768 /* Version of the Greybus PWM protocol we support */
769 #define GB_PWM_VERSION_MAJOR 0x00
770 #define GB_PWM_VERSION_MINOR 0x01
772 /* Greybus PWM operation types */
773 #define GB_PWM_TYPE_PWM_COUNT 0x02
774 #define GB_PWM_TYPE_ACTIVATE 0x03
775 #define GB_PWM_TYPE_DEACTIVATE 0x04
776 #define GB_PWM_TYPE_CONFIG 0x05
777 #define GB_PWM_TYPE_POLARITY 0x06
778 #define GB_PWM_TYPE_ENABLE 0x07
779 #define GB_PWM_TYPE_DISABLE 0x08
781 /* pwm count request has no payload */
782 struct gb_pwm_count_response {
786 struct gb_pwm_activate_request {
790 struct gb_pwm_deactivate_request {
794 struct gb_pwm_config_request {
800 struct gb_pwm_polarity_request {
805 struct gb_pwm_enable_request {
809 struct gb_pwm_disable_request {
815 /* Version of the Greybus spi protocol we support */
816 #define GB_SPI_VERSION_MAJOR 0x00
817 #define GB_SPI_VERSION_MINOR 0x01
819 /* Should match up with modes in linux/spi/spi.h */
820 #define GB_SPI_MODE_CPHA 0x01 /* clock phase */
821 #define GB_SPI_MODE_CPOL 0x02 /* clock polarity */
822 #define GB_SPI_MODE_MODE_0 (0|0) /* (original MicroWire) */
823 #define GB_SPI_MODE_MODE_1 (0|GB_SPI_MODE_CPHA)
824 #define GB_SPI_MODE_MODE_2 (GB_SPI_MODE_CPOL|0)
825 #define GB_SPI_MODE_MODE_3 (GB_SPI_MODE_CPOL|GB_SPI_MODE_CPHA)
826 #define GB_SPI_MODE_CS_HIGH 0x04 /* chipselect active high? */
827 #define GB_SPI_MODE_LSB_FIRST 0x08 /* per-word bits-on-wire */
828 #define GB_SPI_MODE_3WIRE 0x10 /* SI/SO signals shared */
829 #define GB_SPI_MODE_LOOP 0x20 /* loopback mode */
830 #define GB_SPI_MODE_NO_CS 0x40 /* 1 dev/bus, no chipselect */
831 #define GB_SPI_MODE_READY 0x80 /* slave pulls low to pause */
833 /* Should match up with flags in linux/spi/spi.h */
834 #define GB_SPI_FLAG_HALF_DUPLEX BIT(0) /* can't do full duplex */
835 #define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */
836 #define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */
838 /* Greybus spi operation types */
839 #define GB_SPI_TYPE_MASTER_CONFIG 0x02
840 #define GB_SPI_TYPE_DEVICE_CONFIG 0x03
841 #define GB_SPI_TYPE_TRANSFER 0x04
843 /* mode request has no payload */
844 struct gb_spi_master_config_response {
845 __le32 bits_per_word_mask;
853 struct gb_spi_device_config_request {
857 struct gb_spi_device_config_response {
862 #define GB_SPI_SPI_DEV 0x00
863 #define GB_SPI_SPI_NOR 0x01
864 #define GB_SPI_SPI_MODALIAS 0x02
869 * struct gb_spi_transfer - a read/write buffer pair
870 * @speed_hz: Select a speed other than the device default for this transfer. If
871 * 0 the default (from @spi_device) is used.
872 * @len: size of rx and tx buffers (in bytes)
873 * @delay_usecs: microseconds to delay after this transfer before (optionally)
874 * changing the chipselect status, then starting the next transfer or
875 * completing this spi_message.
876 * @cs_change: affects chipselect after this transfer completes
877 * @bits_per_word: select a bits_per_word other than the device default for this
878 * transfer. If 0 the default (from @spi_device) is used.
880 struct gb_spi_transfer {
887 #define GB_SPI_XFER_READ 0x01
888 #define GB_SPI_XFER_WRITE 0x02
889 #define GB_SPI_XFER_INPROGRESS 0x04
892 struct gb_spi_transfer_request {
893 __u8 chip_select; /* of the spi device */
894 __u8 mode; /* of the spi device */
896 struct gb_spi_transfer transfers[0]; /* count of these */
899 struct gb_spi_transfer_response {
900 __u8 data[0]; /* inbound data */
903 /* Version of the Greybus SVC protocol we support */
904 #define GB_SVC_VERSION_MAJOR 0x00
905 #define GB_SVC_VERSION_MINOR 0x01
907 /* Greybus SVC request types */
908 #define GB_SVC_TYPE_PROTOCOL_VERSION 0x01
909 #define GB_SVC_TYPE_SVC_HELLO 0x02
910 #define GB_SVC_TYPE_INTF_DEVICE_ID 0x03
911 #define GB_SVC_TYPE_INTF_HOTPLUG 0x04
912 #define GB_SVC_TYPE_INTF_HOT_UNPLUG 0x05
913 #define GB_SVC_TYPE_INTF_RESET 0x06
914 #define GB_SVC_TYPE_CONN_CREATE 0x07
915 #define GB_SVC_TYPE_CONN_DESTROY 0x08
916 #define GB_SVC_TYPE_DME_PEER_GET 0x09
917 #define GB_SVC_TYPE_DME_PEER_SET 0x0a
918 #define GB_SVC_TYPE_ROUTE_CREATE 0x0b
919 #define GB_SVC_TYPE_ROUTE_DESTROY 0x0c
920 #define GB_SVC_TYPE_TIMESYNC_ENABLE 0x0d
921 #define GB_SVC_TYPE_TIMESYNC_DISABLE 0x0e
922 #define GB_SVC_TYPE_TIMESYNC_AUTHORITATIVE 0x0f
923 #define GB_SVC_TYPE_INTF_SET_PWRM 0x10
924 #define GB_SVC_TYPE_INTF_EJECT 0x11
925 #define GB_SVC_TYPE_KEY_EVENT 0x12
926 #define GB_SVC_TYPE_PING 0x13
927 #define GB_SVC_TYPE_PWRMON_RAIL_COUNT_GET 0x14
928 #define GB_SVC_TYPE_PWRMON_RAIL_NAMES_GET 0x15
929 #define GB_SVC_TYPE_PWRMON_SAMPLE_GET 0x16
930 #define GB_SVC_TYPE_PWRMON_INTF_SAMPLE_GET 0x17
931 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_ACQUIRE 0x18
932 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_RELEASE 0x19
933 #define GB_SVC_TYPE_TIMESYNC_PING 0x1a
934 #define GB_SVC_TYPE_MODULE_INSERTED 0x1f
935 #define GB_SVC_TYPE_MODULE_REMOVED 0x20
936 #define GB_SVC_TYPE_INTF_VSYS_ENABLE 0x21
937 #define GB_SVC_TYPE_INTF_VSYS_DISABLE 0x22
938 #define GB_SVC_TYPE_INTF_REFCLK_ENABLE 0x23
939 #define GB_SVC_TYPE_INTF_REFCLK_DISABLE 0x24
940 #define GB_SVC_TYPE_INTF_UNIPRO_ENABLE 0x25
941 #define GB_SVC_TYPE_INTF_UNIPRO_DISABLE 0x26
942 #define GB_SVC_TYPE_INTF_ACTIVATE 0x27
943 #define GB_SVC_TYPE_INTF_MAILBOX_EVENT 0x29
945 /* Greybus SVC protocol status values */
946 #define GB_SVC_OP_SUCCESS 0x00
947 #define GB_SVC_OP_UNKNOWN_ERROR 0x01
948 #define GB_SVC_INTF_NOT_DETECTED 0x02
949 #define GB_SVC_INTF_NO_UPRO_LINK 0x03
950 #define GB_SVC_INTF_UPRO_NOT_DOWN 0x04
951 #define GB_SVC_INTF_UPRO_NOT_HIBERNATED 0x05
952 #define GB_SVC_INTF_NO_V_SYS 0x06
953 #define GB_SVC_INTF_V_CHG 0x07
954 #define GB_SVC_INTF_WAKE_BUSY 0x08
955 #define GB_SVC_INTF_NO_REFCLK 0x09
956 #define GB_SVC_INTF_RELEASING 0x0a
957 #define GB_SVC_INTF_NO_ORDER 0x0b
958 #define GB_SVC_INTF_MBOX_SET 0x0c
959 #define GB_SVC_INTF_BAD_MBOX 0x0d
960 #define GB_SVC_INTF_OP_TIMEOUT 0x0e
961 #define GB_SVC_PWRMON_OP_NOT_PRESENT 0x0f
963 struct gb_svc_version_request {
968 struct gb_svc_version_response {
973 /* SVC protocol hello request */
974 struct gb_svc_hello_request {
978 /* hello response has no payload */
980 struct gb_svc_intf_device_id_request {
984 /* device id response has no payload */
986 struct gb_svc_intf_hotplug_request {
990 __le32 ddbl1_prod_id;
993 __le64 serial_number;
996 /* hotplug response has no payload */
998 struct gb_svc_intf_hot_unplug_request {
1001 /* hot unplug response has no payload */
1003 struct gb_svc_intf_reset_request {
1006 /* interface reset response has no payload */
1008 struct gb_svc_intf_eject_request {
1011 /* interface eject response has no payload */
1013 struct gb_svc_conn_create_request {
1021 /* connection create response has no payload */
1023 struct gb_svc_conn_destroy_request {
1029 /* connection destroy response has no payload */
1031 struct gb_svc_dme_peer_get_request {
1037 struct gb_svc_dme_peer_get_response {
1042 struct gb_svc_dme_peer_set_request {
1049 struct gb_svc_dme_peer_set_response {
1053 /* Greybus init-status values, currently retrieved using DME peer gets. */
1054 #define GB_INIT_SPI_BOOT_STARTED 0x02
1055 #define GB_INIT_TRUSTED_SPI_BOOT_FINISHED 0x03
1056 #define GB_INIT_UNTRUSTED_SPI_BOOT_FINISHED 0x04
1057 #define GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED 0x06
1058 #define GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED 0x09
1060 struct gb_svc_route_create_request {
1066 /* route create response has no payload */
1068 struct gb_svc_route_destroy_request {
1072 /* route destroy response has no payload */
1074 /* used for svc_intf_vsys_{enable,disable} */
1075 struct gb_svc_intf_vsys_request {
1079 struct gb_svc_intf_vsys_response {
1081 #define GB_SVC_INTF_VSYS_OK 0x00
1082 #define GB_SVC_INTF_VSYS_BUSY 0x01
1083 #define GB_SVC_INTF_VSYS_FAIL 0x02
1086 /* used for svc_intf_refclk_{enable,disable} */
1087 struct gb_svc_intf_refclk_request {
1091 struct gb_svc_intf_refclk_response {
1093 #define GB_SVC_INTF_REFCLK_OK 0x00
1094 #define GB_SVC_INTF_REFCLK_BUSY 0x01
1095 #define GB_SVC_INTF_REFCLK_FAIL 0x02
1098 /* used for svc_intf_unipro_{enable,disable} */
1099 struct gb_svc_intf_unipro_request {
1103 struct gb_svc_intf_unipro_response {
1105 #define GB_SVC_INTF_UNIPRO_OK 0x00
1106 #define GB_SVC_INTF_UNIPRO_BUSY 0x01
1107 #define GB_SVC_INTF_UNIPRO_FAIL 0x02
1108 #define GB_SVC_INTF_UNIPRO_NOT_OFF 0x03
1111 struct gb_svc_timesync_enable_request {
1114 __le32 strobe_delay;
1117 /* timesync enable response has no payload */
1119 /* timesync authoritative request has no payload */
1120 struct gb_svc_timesync_authoritative_response {
1121 __le64 frame_time[GB_TIMESYNC_MAX_STROBES];
1124 struct gb_svc_timesync_wake_pins_acquire_request {
1128 /* timesync wake pins acquire response has no payload */
1130 /* timesync wake pins release request has no payload */
1131 /* timesync wake pins release response has no payload */
1133 /* timesync svc ping request has no payload */
1134 struct gb_svc_timesync_ping_response {
1138 #define GB_SVC_UNIPRO_FAST_MODE 0x01
1139 #define GB_SVC_UNIPRO_SLOW_MODE 0x02
1140 #define GB_SVC_UNIPRO_FAST_AUTO_MODE 0x04
1141 #define GB_SVC_UNIPRO_SLOW_AUTO_MODE 0x05
1142 #define GB_SVC_UNIPRO_MODE_UNCHANGED 0x07
1143 #define GB_SVC_UNIPRO_HIBERNATE_MODE 0x11
1144 #define GB_SVC_UNIPRO_OFF_MODE 0x12
1146 #define GB_SVC_PWRM_RXTERMINATION 0x01
1147 #define GB_SVC_PWRM_TXTERMINATION 0x02
1148 #define GB_SVC_PWRM_LINE_RESET 0x04
1149 #define GB_SVC_PWRM_SCRAMBLING 0x20
1151 #define GB_SVC_PWRM_QUIRK_HSSER 0x00000001
1153 #define GB_SVC_UNIPRO_HS_SERIES_A 0x01
1154 #define GB_SVC_UNIPRO_HS_SERIES_B 0x02
1156 struct gb_svc_intf_set_pwrm_request {
1169 struct gb_svc_intf_set_pwrm_response {
1173 struct gb_svc_key_event_request {
1175 #define GB_KEYCODE_ARA 0x00
1178 #define GB_SVC_KEY_RELEASED 0x00
1179 #define GB_SVC_KEY_PRESSED 0x01
1182 #define GB_SVC_PWRMON_MAX_RAIL_COUNT 254
1184 struct gb_svc_pwrmon_rail_count_get_response {
1188 #define GB_SVC_PWRMON_RAIL_NAME_BUFSIZE 32
1190 struct gb_svc_pwrmon_rail_names_get_response {
1191 __u8 name[0][GB_SVC_PWRMON_RAIL_NAME_BUFSIZE];
1194 #define GB_SVC_PWRMON_TYPE_CURR 0x01
1195 #define GB_SVC_PWRMON_TYPE_VOL 0x02
1196 #define GB_SVC_PWRMON_TYPE_PWR 0x03
1198 #define GB_SVC_PWRMON_GET_SAMPLE_OK 0x00
1199 #define GB_SVC_PWRMON_GET_SAMPLE_INVAL 0x01
1200 #define GB_SVC_PWRMON_GET_SAMPLE_NOSUPP 0x02
1201 #define GB_SVC_PWRMON_GET_SAMPLE_HWERR 0x03
1203 struct gb_svc_pwrmon_sample_get_request {
1205 __u8 measurement_type;
1208 struct gb_svc_pwrmon_sample_get_response {
1213 struct gb_svc_pwrmon_intf_sample_get_request {
1215 __u8 measurement_type;
1218 struct gb_svc_pwrmon_intf_sample_get_response {
1223 #define GB_SVC_MODULE_INSERTED_FLAG_NO_PRIMARY 0x0001
1225 struct gb_svc_module_inserted_request {
1226 __u8 primary_intf_id;
1230 /* module_inserted response has no payload */
1232 struct gb_svc_module_removed_request {
1233 __u8 primary_intf_id;
1235 /* module_removed response has no payload */
1237 struct gb_svc_intf_activate_request {
1241 #define GB_SVC_INTF_TYPE_UNKNOWN 0x00
1242 #define GB_SVC_INTF_TYPE_DUMMY 0x01
1243 #define GB_SVC_INTF_TYPE_UNIPRO 0x02
1244 #define GB_SVC_INTF_TYPE_GREYBUS 0x03
1246 struct gb_svc_intf_activate_response {
1251 #define GB_SVC_INTF_MAILBOX_NONE 0x00
1252 #define GB_SVC_INTF_MAILBOX_AP 0x01
1253 #define GB_SVC_INTF_MAILBOX_GREYBUS 0x02
1255 struct gb_svc_intf_mailbox_event_request {
1260 /* intf_mailbox_event response has no payload */
1265 /* Version of the Greybus raw protocol we support */
1266 #define GB_RAW_VERSION_MAJOR 0x00
1267 #define GB_RAW_VERSION_MINOR 0x01
1269 /* Greybus raw request types */
1270 #define GB_RAW_TYPE_SEND 0x02
1272 struct gb_raw_send_request {
1280 /* Version of the Greybus UART protocol we support */
1281 #define GB_UART_VERSION_MAJOR 0x00
1282 #define GB_UART_VERSION_MINOR 0x01
1284 /* Greybus UART operation types */
1285 #define GB_UART_TYPE_SEND_DATA 0x02
1286 #define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */
1287 #define GB_UART_TYPE_SET_LINE_CODING 0x04
1288 #define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05
1289 #define GB_UART_TYPE_SEND_BREAK 0x06
1290 #define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
1292 /* Represents data from AP -> Module */
1293 struct gb_uart_send_data_request {
1298 /* recv-data-request flags */
1299 #define GB_UART_RECV_FLAG_FRAMING 0x01 /* Framing error */
1300 #define GB_UART_RECV_FLAG_PARITY 0x02 /* Parity error */
1301 #define GB_UART_RECV_FLAG_OVERRUN 0x04 /* Overrun error */
1302 #define GB_UART_RECV_FLAG_BREAK 0x08 /* Break */
1304 /* Represents data from Module -> AP */
1305 struct gb_uart_recv_data_request {
1311 struct gb_uart_set_line_coding_request {
1314 #define GB_SERIAL_1_STOP_BITS 0
1315 #define GB_SERIAL_1_5_STOP_BITS 1
1316 #define GB_SERIAL_2_STOP_BITS 2
1319 #define GB_SERIAL_NO_PARITY 0
1320 #define GB_SERIAL_ODD_PARITY 1
1321 #define GB_SERIAL_EVEN_PARITY 2
1322 #define GB_SERIAL_MARK_PARITY 3
1323 #define GB_SERIAL_SPACE_PARITY 4
1328 /* output control lines */
1329 #define GB_UART_CTRL_DTR 0x01
1330 #define GB_UART_CTRL_RTS 0x02
1332 struct gb_uart_set_control_line_state_request {
1336 struct gb_uart_set_break_request {
1340 /* input control lines and line errors */
1341 #define GB_UART_CTRL_DCD 0x01
1342 #define GB_UART_CTRL_DSR 0x02
1343 #define GB_UART_CTRL_RI 0x04
1345 struct gb_uart_serial_state_request {
1351 /* Version of the Greybus loopback protocol we support */
1352 #define GB_LOOPBACK_VERSION_MAJOR 0x00
1353 #define GB_LOOPBACK_VERSION_MINOR 0x01
1355 /* Greybus loopback request types */
1356 #define GB_LOOPBACK_TYPE_PING 0x02
1357 #define GB_LOOPBACK_TYPE_TRANSFER 0x03
1358 #define GB_LOOPBACK_TYPE_SINK 0x04
1361 * Loopback request/response header format should be identical
1362 * to simplify bandwidth and data movement analysis.
1364 struct gb_loopback_transfer_request {
1371 struct gb_loopback_transfer_response {
1379 /* Version of the Greybus sdio protocol we support */
1380 #define GB_SDIO_VERSION_MAJOR 0x00
1381 #define GB_SDIO_VERSION_MINOR 0x01
1383 /* Greybus SDIO operation types */
1384 #define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
1385 #define GB_SDIO_TYPE_SET_IOS 0x03
1386 #define GB_SDIO_TYPE_COMMAND 0x04
1387 #define GB_SDIO_TYPE_TRANSFER 0x05
1388 #define GB_SDIO_TYPE_EVENT 0x06
1390 /* get caps response: request has no payload */
1391 struct gb_sdio_get_caps_response {
1393 #define GB_SDIO_CAP_NONREMOVABLE 0x00000001
1394 #define GB_SDIO_CAP_4_BIT_DATA 0x00000002
1395 #define GB_SDIO_CAP_8_BIT_DATA 0x00000004
1396 #define GB_SDIO_CAP_MMC_HS 0x00000008
1397 #define GB_SDIO_CAP_SD_HS 0x00000010
1398 #define GB_SDIO_CAP_ERASE 0x00000020
1399 #define GB_SDIO_CAP_1_2V_DDR 0x00000040
1400 #define GB_SDIO_CAP_1_8V_DDR 0x00000080
1401 #define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100
1402 #define GB_SDIO_CAP_UHS_SDR12 0x00000200
1403 #define GB_SDIO_CAP_UHS_SDR25 0x00000400
1404 #define GB_SDIO_CAP_UHS_SDR50 0x00000800
1405 #define GB_SDIO_CAP_UHS_SDR104 0x00001000
1406 #define GB_SDIO_CAP_UHS_DDR50 0x00002000
1407 #define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000
1408 #define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000
1409 #define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000
1410 #define GB_SDIO_CAP_HS200_1_2V 0x00020000
1411 #define GB_SDIO_CAP_HS200_1_8V 0x00040000
1412 #define GB_SDIO_CAP_HS400_1_2V 0x00080000
1413 #define GB_SDIO_CAP_HS400_1_8V 0x00100000
1415 /* see possible values below at vdd */
1417 __le16 max_blk_count;
1418 __le16 max_blk_size;
1423 /* set ios request: response has no payload */
1424 struct gb_sdio_set_ios_request {
1427 #define GB_SDIO_VDD_165_195 0x00000001
1428 #define GB_SDIO_VDD_20_21 0x00000002
1429 #define GB_SDIO_VDD_21_22 0x00000004
1430 #define GB_SDIO_VDD_22_23 0x00000008
1431 #define GB_SDIO_VDD_23_24 0x00000010
1432 #define GB_SDIO_VDD_24_25 0x00000020
1433 #define GB_SDIO_VDD_25_26 0x00000040
1434 #define GB_SDIO_VDD_26_27 0x00000080
1435 #define GB_SDIO_VDD_27_28 0x00000100
1436 #define GB_SDIO_VDD_28_29 0x00000200
1437 #define GB_SDIO_VDD_29_30 0x00000400
1438 #define GB_SDIO_VDD_30_31 0x00000800
1439 #define GB_SDIO_VDD_31_32 0x00001000
1440 #define GB_SDIO_VDD_32_33 0x00002000
1441 #define GB_SDIO_VDD_33_34 0x00004000
1442 #define GB_SDIO_VDD_34_35 0x00008000
1443 #define GB_SDIO_VDD_35_36 0x00010000
1446 #define GB_SDIO_BUSMODE_OPENDRAIN 0x00
1447 #define GB_SDIO_BUSMODE_PUSHPULL 0x01
1450 #define GB_SDIO_POWER_OFF 0x00
1451 #define GB_SDIO_POWER_UP 0x01
1452 #define GB_SDIO_POWER_ON 0x02
1453 #define GB_SDIO_POWER_UNDEFINED 0x03
1456 #define GB_SDIO_BUS_WIDTH_1 0x00
1457 #define GB_SDIO_BUS_WIDTH_4 0x02
1458 #define GB_SDIO_BUS_WIDTH_8 0x03
1461 #define GB_SDIO_TIMING_LEGACY 0x00
1462 #define GB_SDIO_TIMING_MMC_HS 0x01
1463 #define GB_SDIO_TIMING_SD_HS 0x02
1464 #define GB_SDIO_TIMING_UHS_SDR12 0x03
1465 #define GB_SDIO_TIMING_UHS_SDR25 0x04
1466 #define GB_SDIO_TIMING_UHS_SDR50 0x05
1467 #define GB_SDIO_TIMING_UHS_SDR104 0x06
1468 #define GB_SDIO_TIMING_UHS_DDR50 0x07
1469 #define GB_SDIO_TIMING_MMC_DDR52 0x08
1470 #define GB_SDIO_TIMING_MMC_HS200 0x09
1471 #define GB_SDIO_TIMING_MMC_HS400 0x0A
1473 __u8 signal_voltage;
1474 #define GB_SDIO_SIGNAL_VOLTAGE_330 0x00
1475 #define GB_SDIO_SIGNAL_VOLTAGE_180 0x01
1476 #define GB_SDIO_SIGNAL_VOLTAGE_120 0x02
1479 #define GB_SDIO_SET_DRIVER_TYPE_B 0x00
1480 #define GB_SDIO_SET_DRIVER_TYPE_A 0x01
1481 #define GB_SDIO_SET_DRIVER_TYPE_C 0x02
1482 #define GB_SDIO_SET_DRIVER_TYPE_D 0x03
1485 /* command request */
1486 struct gb_sdio_command_request {
1489 #define GB_SDIO_RSP_NONE 0x00
1490 #define GB_SDIO_RSP_PRESENT 0x01
1491 #define GB_SDIO_RSP_136 0x02
1492 #define GB_SDIO_RSP_CRC 0x04
1493 #define GB_SDIO_RSP_BUSY 0x08
1494 #define GB_SDIO_RSP_OPCODE 0x10
1497 #define GB_SDIO_CMD_AC 0x00
1498 #define GB_SDIO_CMD_ADTC 0x01
1499 #define GB_SDIO_CMD_BC 0x02
1500 #define GB_SDIO_CMD_BCR 0x03
1507 struct gb_sdio_command_response {
1511 /* transfer request */
1512 struct gb_sdio_transfer_request {
1514 #define GB_SDIO_DATA_WRITE 0x01
1515 #define GB_SDIO_DATA_READ 0x02
1516 #define GB_SDIO_DATA_STREAM 0x04
1523 struct gb_sdio_transfer_response {
1529 /* event request: generated by module and is defined as unidirectional */
1530 struct gb_sdio_event_request {
1532 #define GB_SDIO_CARD_INSERTED 0x01
1533 #define GB_SDIO_CARD_REMOVED 0x02
1534 #define GB_SDIO_WP 0x04
1539 #define GB_CAMERA_VERSION_MAJOR 0x00
1540 #define GB_CAMERA_VERSION_MINOR 0x01
1542 /* Greybus Camera request types */
1543 #define GB_CAMERA_TYPE_CAPABILITIES 0x02
1544 #define GB_CAMERA_TYPE_CONFIGURE_STREAMS 0x03
1545 #define GB_CAMERA_TYPE_CAPTURE 0x04
1546 #define GB_CAMERA_TYPE_FLUSH 0x05
1547 #define GB_CAMERA_TYPE_METADATA 0x06
1549 #define GB_CAMERA_MAX_STREAMS 4
1550 #define GB_CAMERA_MAX_SETTINGS_SIZE 8192
1552 /* Greybus Camera Configure Streams request payload */
1553 struct gb_camera_stream_config_request {
1560 struct gb_camera_configure_streams_request {
1563 #define GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY 0x01
1565 struct gb_camera_stream_config_request config[0];
1568 /* Greybus Camera Configure Streams response payload */
1569 struct gb_camera_stream_config_response {
1573 __u8 virtual_channel;
1579 struct gb_camera_configure_streams_response {
1582 #define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED 0x01
1586 __le32 lines_per_second;
1587 struct gb_camera_stream_config_response config[0];
1590 /* Greybus Camera Capture request payload - response has no payload */
1591 struct gb_camera_capture_request {
1599 /* Greybus Camera Flush response payload - request has no payload */
1600 struct gb_camera_flush_response {
1604 /* Greybus Camera Metadata request payload - operation has no response */
1605 struct gb_camera_metadata_request {
1607 __le16 frame_number;
1615 #define GB_LIGHTS_VERSION_MAJOR 0x00
1616 #define GB_LIGHTS_VERSION_MINOR 0x01
1618 /* Greybus Lights request types */
1619 #define GB_LIGHTS_TYPE_GET_LIGHTS 0x02
1620 #define GB_LIGHTS_TYPE_GET_LIGHT_CONFIG 0x03
1621 #define GB_LIGHTS_TYPE_GET_CHANNEL_CONFIG 0x04
1622 #define GB_LIGHTS_TYPE_GET_CHANNEL_FLASH_CONFIG 0x05
1623 #define GB_LIGHTS_TYPE_SET_BRIGHTNESS 0x06
1624 #define GB_LIGHTS_TYPE_SET_BLINK 0x07
1625 #define GB_LIGHTS_TYPE_SET_COLOR 0x08
1626 #define GB_LIGHTS_TYPE_SET_FADE 0x09
1627 #define GB_LIGHTS_TYPE_EVENT 0x0A
1628 #define GB_LIGHTS_TYPE_SET_FLASH_INTENSITY 0x0B
1629 #define GB_LIGHTS_TYPE_SET_FLASH_STROBE 0x0C
1630 #define GB_LIGHTS_TYPE_SET_FLASH_TIMEOUT 0x0D
1631 #define GB_LIGHTS_TYPE_GET_FLASH_FAULT 0x0E
1633 /* Greybus Light modes */
1636 * if you add any specific mode below, update also the
1637 * GB_CHANNEL_MODE_DEFINED_RANGE value accordingly
1639 #define GB_CHANNEL_MODE_NONE 0x00000000
1640 #define GB_CHANNEL_MODE_BATTERY 0x00000001
1641 #define GB_CHANNEL_MODE_POWER 0x00000002
1642 #define GB_CHANNEL_MODE_WIRELESS 0x00000004
1643 #define GB_CHANNEL_MODE_BLUETOOTH 0x00000008
1644 #define GB_CHANNEL_MODE_KEYBOARD 0x00000010
1645 #define GB_CHANNEL_MODE_BUTTONS 0x00000020
1646 #define GB_CHANNEL_MODE_NOTIFICATION 0x00000040
1647 #define GB_CHANNEL_MODE_ATTENTION 0x00000080
1648 #define GB_CHANNEL_MODE_FLASH 0x00000100
1649 #define GB_CHANNEL_MODE_TORCH 0x00000200
1650 #define GB_CHANNEL_MODE_INDICATOR 0x00000400
1652 /* Lights Mode valid bit values */
1653 #define GB_CHANNEL_MODE_DEFINED_RANGE 0x000004FF
1654 #define GB_CHANNEL_MODE_VENDOR_RANGE 0x00F00000
1656 /* Greybus Light Channels Flags */
1657 #define GB_LIGHT_CHANNEL_MULTICOLOR 0x00000001
1658 #define GB_LIGHT_CHANNEL_FADER 0x00000002
1659 #define GB_LIGHT_CHANNEL_BLINK 0x00000004
1661 /* get count of lights in module */
1662 struct gb_lights_get_lights_response {
1666 /* light config request payload */
1667 struct gb_lights_get_light_config_request {
1671 /* light config response payload */
1672 struct gb_lights_get_light_config_response {
1677 /* channel config request payload */
1678 struct gb_lights_get_channel_config_request {
1683 /* channel flash config request payload */
1684 struct gb_lights_get_channel_flash_config_request {
1689 /* channel config response payload */
1690 struct gb_lights_get_channel_config_response {
1691 __u8 max_brightness;
1694 __u8 color_name[32];
1699 /* channel flash config response payload */
1700 struct gb_lights_get_channel_flash_config_response {
1701 __le32 intensity_min_uA;
1702 __le32 intensity_max_uA;
1703 __le32 intensity_step_uA;
1704 __le32 timeout_min_us;
1705 __le32 timeout_max_us;
1706 __le32 timeout_step_us;
1709 /* blink request payload: response have no payload */
1710 struct gb_lights_blink_request {
1717 /* set brightness request payload: response have no payload */
1718 struct gb_lights_set_brightness_request {
1724 /* set color request payload: response have no payload */
1725 struct gb_lights_set_color_request {
1731 /* set fade request payload: response have no payload */
1732 struct gb_lights_set_fade_request {
1739 /* event request: generated by module */
1740 struct gb_lights_event_request {
1743 #define GB_LIGHTS_LIGHT_CONFIG 0x01
1746 /* set flash intensity request payload: response have no payload */
1747 struct gb_lights_set_flash_intensity_request {
1750 __le32 intensity_uA;
1753 /* set flash strobe state request payload: response have no payload */
1754 struct gb_lights_set_flash_strobe_request {
1760 /* set flash timeout request payload: response have no payload */
1761 struct gb_lights_set_flash_timeout_request {
1767 /* get flash fault request payload */
1768 struct gb_lights_get_flash_fault_request {
1773 /* get flash fault response payload */
1774 struct gb_lights_get_flash_fault_response {
1776 #define GB_LIGHTS_FLASH_FAULT_OVER_VOLTAGE 0x00000000
1777 #define GB_LIGHTS_FLASH_FAULT_TIMEOUT 0x00000001
1778 #define GB_LIGHTS_FLASH_FAULT_OVER_TEMPERATURE 0x00000002
1779 #define GB_LIGHTS_FLASH_FAULT_SHORT_CIRCUIT 0x00000004
1780 #define GB_LIGHTS_FLASH_FAULT_OVER_CURRENT 0x00000008
1781 #define GB_LIGHTS_FLASH_FAULT_INDICATOR 0x00000010
1782 #define GB_LIGHTS_FLASH_FAULT_UNDER_VOLTAGE 0x00000020
1783 #define GB_LIGHTS_FLASH_FAULT_INPUT_VOLTAGE 0x00000040
1784 #define GB_LIGHTS_FLASH_FAULT_LED_OVER_TEMPERATURE 0x00000080
1789 /* Version of the Greybus audio protocol we support */
1790 #define GB_AUDIO_VERSION_MAJOR 0x00
1791 #define GB_AUDIO_VERSION_MINOR 0x01
1793 #define GB_AUDIO_TYPE_PROTOCOL_VERSION 0x01
1794 #define GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE 0x02
1795 #define GB_AUDIO_TYPE_GET_TOPOLOGY 0x03
1796 #define GB_AUDIO_TYPE_GET_CONTROL 0x04
1797 #define GB_AUDIO_TYPE_SET_CONTROL 0x05
1798 #define GB_AUDIO_TYPE_ENABLE_WIDGET 0x06
1799 #define GB_AUDIO_TYPE_DISABLE_WIDGET 0x07
1800 #define GB_AUDIO_TYPE_GET_PCM 0x08
1801 #define GB_AUDIO_TYPE_SET_PCM 0x09
1802 #define GB_AUDIO_TYPE_SET_TX_DATA_SIZE 0x0a
1803 #define GB_AUDIO_TYPE_GET_TX_DELAY 0x0b
1804 #define GB_AUDIO_TYPE_ACTIVATE_TX 0x0c
1805 #define GB_AUDIO_TYPE_DEACTIVATE_TX 0x0d
1806 #define GB_AUDIO_TYPE_SET_RX_DATA_SIZE 0x0e
1807 #define GB_AUDIO_TYPE_GET_RX_DELAY 0x0f
1808 #define GB_AUDIO_TYPE_ACTIVATE_RX 0x10
1809 #define GB_AUDIO_TYPE_DEACTIVATE_RX 0x11
1810 #define GB_AUDIO_TYPE_JACK_EVENT 0x12
1811 #define GB_AUDIO_TYPE_BUTTON_EVENT 0x13
1812 #define GB_AUDIO_TYPE_STREAMING_EVENT 0x14
1813 #define GB_AUDIO_TYPE_SEND_DATA 0x15
1815 /* Module must be able to buffer 10ms of audio data, minimum */
1816 #define GB_AUDIO_SAMPLE_BUFFER_MIN_US 10000
1818 #define GB_AUDIO_PCM_NAME_MAX 32
1819 #define AUDIO_DAI_NAME_MAX 32
1820 #define AUDIO_CONTROL_NAME_MAX 32
1821 #define AUDIO_CTL_ELEM_NAME_MAX 44
1822 #define AUDIO_ENUM_NAME_MAX 64
1823 #define AUDIO_WIDGET_NAME_MAX 32
1825 /* See SNDRV_PCM_FMTBIT_* in Linux source */
1826 #define GB_AUDIO_PCM_FMT_S8 BIT(0)
1827 #define GB_AUDIO_PCM_FMT_U8 BIT(1)
1828 #define GB_AUDIO_PCM_FMT_S16_LE BIT(2)
1829 #define GB_AUDIO_PCM_FMT_S16_BE BIT(3)
1830 #define GB_AUDIO_PCM_FMT_U16_LE BIT(4)
1831 #define GB_AUDIO_PCM_FMT_U16_BE BIT(5)
1832 #define GB_AUDIO_PCM_FMT_S24_LE BIT(6)
1833 #define GB_AUDIO_PCM_FMT_S24_BE BIT(7)
1834 #define GB_AUDIO_PCM_FMT_U24_LE BIT(8)
1835 #define GB_AUDIO_PCM_FMT_U24_BE BIT(9)
1836 #define GB_AUDIO_PCM_FMT_S32_LE BIT(10)
1837 #define GB_AUDIO_PCM_FMT_S32_BE BIT(11)
1838 #define GB_AUDIO_PCM_FMT_U32_LE BIT(12)
1839 #define GB_AUDIO_PCM_FMT_U32_BE BIT(13)
1841 /* See SNDRV_PCM_RATE_* in Linux source */
1842 #define GB_AUDIO_PCM_RATE_5512 BIT(0)
1843 #define GB_AUDIO_PCM_RATE_8000 BIT(1)
1844 #define GB_AUDIO_PCM_RATE_11025 BIT(2)
1845 #define GB_AUDIO_PCM_RATE_16000 BIT(3)
1846 #define GB_AUDIO_PCM_RATE_22050 BIT(4)
1847 #define GB_AUDIO_PCM_RATE_32000 BIT(5)
1848 #define GB_AUDIO_PCM_RATE_44100 BIT(6)
1849 #define GB_AUDIO_PCM_RATE_48000 BIT(7)
1850 #define GB_AUDIO_PCM_RATE_64000 BIT(8)
1851 #define GB_AUDIO_PCM_RATE_88200 BIT(9)
1852 #define GB_AUDIO_PCM_RATE_96000 BIT(10)
1853 #define GB_AUDIO_PCM_RATE_176400 BIT(11)
1854 #define GB_AUDIO_PCM_RATE_192000 BIT(12)
1856 #define GB_AUDIO_STREAM_TYPE_CAPTURE 0x1
1857 #define GB_AUDIO_STREAM_TYPE_PLAYBACK 0x2
1859 #define GB_AUDIO_CTL_ELEM_ACCESS_READ BIT(0)
1860 #define GB_AUDIO_CTL_ELEM_ACCESS_WRITE BIT(1)
1862 /* See SNDRV_CTL_ELEM_TYPE_* in Linux source */
1863 #define GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN 0x01
1864 #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER 0x02
1865 #define GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED 0x03
1866 #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER64 0x06
1868 /* See SNDRV_CTL_ELEM_IFACE_* in Linux source */
1869 #define GB_AUDIO_CTL_ELEM_IFACE_CARD 0x00
1870 #define GB_AUDIO_CTL_ELEM_IFACE_HWDEP 0x01
1871 #define GB_AUDIO_CTL_ELEM_IFACE_MIXER 0x02
1872 #define GB_AUDIO_CTL_ELEM_IFACE_PCM 0x03
1873 #define GB_AUDIO_CTL_ELEM_IFACE_RAWMIDI 0x04
1874 #define GB_AUDIO_CTL_ELEM_IFACE_TIMER 0x05
1875 #define GB_AUDIO_CTL_ELEM_IFACE_SEQUENCER 0x06
1877 /* SNDRV_CTL_ELEM_ACCESS_* in Linux source */
1878 #define GB_AUDIO_ACCESS_READ BIT(0)
1879 #define GB_AUDIO_ACCESS_WRITE BIT(1)
1880 #define GB_AUDIO_ACCESS_VOLATILE BIT(2)
1881 #define GB_AUDIO_ACCESS_TIMESTAMP BIT(3)
1882 #define GB_AUDIO_ACCESS_TLV_READ BIT(4)
1883 #define GB_AUDIO_ACCESS_TLV_WRITE BIT(5)
1884 #define GB_AUDIO_ACCESS_TLV_COMMAND BIT(6)
1885 #define GB_AUDIO_ACCESS_INACTIVE BIT(7)
1886 #define GB_AUDIO_ACCESS_LOCK BIT(8)
1887 #define GB_AUDIO_ACCESS_OWNER BIT(9)
1889 /* enum snd_soc_dapm_type */
1890 #define GB_AUDIO_WIDGET_TYPE_INPUT 0x0
1891 #define GB_AUDIO_WIDGET_TYPE_OUTPUT 0x1
1892 #define GB_AUDIO_WIDGET_TYPE_MUX 0x2
1893 #define GB_AUDIO_WIDGET_TYPE_VIRT_MUX 0x3
1894 #define GB_AUDIO_WIDGET_TYPE_VALUE_MUX 0x4
1895 #define GB_AUDIO_WIDGET_TYPE_MIXER 0x5
1896 #define GB_AUDIO_WIDGET_TYPE_MIXER_NAMED_CTL 0x6
1897 #define GB_AUDIO_WIDGET_TYPE_PGA 0x7
1898 #define GB_AUDIO_WIDGET_TYPE_OUT_DRV 0x8
1899 #define GB_AUDIO_WIDGET_TYPE_ADC 0x9
1900 #define GB_AUDIO_WIDGET_TYPE_DAC 0xa
1901 #define GB_AUDIO_WIDGET_TYPE_MICBIAS 0xb
1902 #define GB_AUDIO_WIDGET_TYPE_MIC 0xc
1903 #define GB_AUDIO_WIDGET_TYPE_HP 0xd
1904 #define GB_AUDIO_WIDGET_TYPE_SPK 0xe
1905 #define GB_AUDIO_WIDGET_TYPE_LINE 0xf
1906 #define GB_AUDIO_WIDGET_TYPE_SWITCH 0x10
1907 #define GB_AUDIO_WIDGET_TYPE_VMID 0x11
1908 #define GB_AUDIO_WIDGET_TYPE_PRE 0x12
1909 #define GB_AUDIO_WIDGET_TYPE_POST 0x13
1910 #define GB_AUDIO_WIDGET_TYPE_SUPPLY 0x14
1911 #define GB_AUDIO_WIDGET_TYPE_REGULATOR_SUPPLY 0x15
1912 #define GB_AUDIO_WIDGET_TYPE_CLOCK_SUPPLY 0x16
1913 #define GB_AUDIO_WIDGET_TYPE_AIF_IN 0x17
1914 #define GB_AUDIO_WIDGET_TYPE_AIF_OUT 0x18
1915 #define GB_AUDIO_WIDGET_TYPE_SIGGEN 0x19
1916 #define GB_AUDIO_WIDGET_TYPE_DAI_IN 0x1a
1917 #define GB_AUDIO_WIDGET_TYPE_DAI_OUT 0x1b
1918 #define GB_AUDIO_WIDGET_TYPE_DAI_LINK 0x1c
1920 #define GB_AUDIO_WIDGET_STATE_DISABLED 0x01
1921 #define GB_AUDIO_WIDGET_STATE_ENAABLED 0x02
1923 #define GB_AUDIO_JACK_EVENT_INSERTION 0x1
1924 #define GB_AUDIO_JACK_EVENT_REMOVAL 0x2
1926 #define GB_AUDIO_BUTTON_EVENT_PRESS 0x1
1927 #define GB_AUDIO_BUTTON_EVENT_RELEASE 0x2
1929 #define GB_AUDIO_STREAMING_EVENT_UNSPECIFIED 0x1
1930 #define GB_AUDIO_STREAMING_EVENT_HALT 0x2
1931 #define GB_AUDIO_STREAMING_EVENT_INTERNAL_ERROR 0x3
1932 #define GB_AUDIO_STREAMING_EVENT_PROTOCOL_ERROR 0x4
1933 #define GB_AUDIO_STREAMING_EVENT_FAILURE 0x5
1934 #define GB_AUDIO_STREAMING_EVENT_UNDERRUN 0x6
1935 #define GB_AUDIO_STREAMING_EVENT_OVERRUN 0x7
1936 #define GB_AUDIO_STREAMING_EVENT_CLOCKING 0x8
1937 #define GB_AUDIO_STREAMING_EVENT_DATA_LEN 0x9
1939 #define GB_AUDIO_INVALID_INDEX 0xff
1941 struct gb_audio_pcm {
1942 __u8 stream_name[GB_AUDIO_PCM_NAME_MAX];
1943 __le32 formats; /* GB_AUDIO_PCM_FMT_* */
1944 __le32 rates; /* GB_AUDIO_PCM_RATE_* */
1947 __u8 sig_bits; /* number of bits of content */
1950 struct gb_audio_dai {
1951 __u8 name[AUDIO_DAI_NAME_MAX];
1953 struct gb_audio_pcm capture;
1954 struct gb_audio_pcm playback;
1957 struct gb_audio_integer {
1963 struct gb_audio_integer64 {
1969 struct gb_audio_enumerated {
1971 __le16 names_length;
1975 struct gb_audio_ctl_elem_info { /* See snd_ctl_elem_info in Linux source */
1976 __u8 type; /* GB_AUDIO_CTL_ELEM_TYPE_* */
1979 struct gb_audio_integer integer;
1980 struct gb_audio_integer64 integer64;
1981 struct gb_audio_enumerated enumerated;
1985 struct gb_audio_ctl_elem_value { /* See snd_ctl_elem_value in Linux source */
1986 __le64 timestamp; /* XXX needed? */
1988 __le32 integer_value[2]; /* consider CTL_DOUBLE_xxx */
1989 __le64 integer64_value[2];
1990 __le32 enumerated_item[2];
1994 struct gb_audio_control {
1995 __u8 name[AUDIO_CONTROL_NAME_MAX];
1997 __u8 iface; /* GB_AUDIO_IFACE_* */
1999 __le32 access; /* GB_AUDIO_ACCESS_* */
2000 __u8 count; /* count of same elements */
2001 __u8 count_values; /* count of values, max=2 for CTL_DOUBLE_xxx */
2002 struct gb_audio_ctl_elem_info info;
2005 struct gb_audio_widget {
2006 __u8 name[AUDIO_WIDGET_NAME_MAX];
2007 __u8 sname[AUDIO_WIDGET_NAME_MAX];
2009 __u8 type; /* GB_AUDIO_WIDGET_TYPE_* */
2010 __u8 state; /* GB_AUDIO_WIDGET_STATE_* */
2012 struct gb_audio_control ctl[0]; /* 'ncontrols' entries */
2015 struct gb_audio_route {
2016 __u8 source_id; /* widget id */
2017 __u8 destination_id; /* widget id */
2018 __u8 control_id; /* 0-63 */
2019 __u8 index; /* Selection within the control */
2022 struct gb_audio_topology {
2028 __u32 size_controls;
2032 * struct gb_audio_dai dai[num_dais];
2033 * struct gb_audio_control controls[num_controls];
2034 * struct gb_audio_widget widgets[num_widgets];
2035 * struct gb_audio_route routes[num_routes];
2040 struct gb_audio_get_topology_size_response {
2044 struct gb_audio_get_topology_response {
2045 struct gb_audio_topology topology;
2048 struct gb_audio_get_control_request {
2053 struct gb_audio_get_control_response {
2054 struct gb_audio_ctl_elem_value value;
2057 struct gb_audio_set_control_request {
2060 struct gb_audio_ctl_elem_value value;
2063 struct gb_audio_enable_widget_request {
2067 struct gb_audio_disable_widget_request {
2071 struct gb_audio_get_pcm_request {
2075 struct gb_audio_get_pcm_response {
2082 struct gb_audio_set_pcm_request {
2090 struct gb_audio_set_tx_data_size_request {
2095 struct gb_audio_get_tx_delay_request {
2099 struct gb_audio_get_tx_delay_response {
2103 struct gb_audio_activate_tx_request {
2107 struct gb_audio_deactivate_tx_request {
2111 struct gb_audio_set_rx_data_size_request {
2116 struct gb_audio_get_rx_delay_request {
2120 struct gb_audio_get_rx_delay_response {
2124 struct gb_audio_activate_rx_request {
2128 struct gb_audio_deactivate_rx_request {
2132 struct gb_audio_jack_event_request {
2134 __u8 jack_attribute;
2138 struct gb_audio_button_event_request {
2144 struct gb_audio_streaming_event_request {
2149 struct gb_audio_send_data_request {
2154 #endif /* __GREYBUS_PROTOCOLS_H */