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_CPORT_SHUTDOWN 0x00
100 #define GB_REQUEST_TYPE_INVALID 0x7f
102 struct gb_cport_shutdown_request {
107 /* Control Protocol */
109 /* Greybus control request types */
110 #define GB_CONTROL_TYPE_VERSION 0x01
111 #define GB_CONTROL_TYPE_PROBE_AP 0x02
112 #define GB_CONTROL_TYPE_GET_MANIFEST_SIZE 0x03
113 #define GB_CONTROL_TYPE_GET_MANIFEST 0x04
114 #define GB_CONTROL_TYPE_CONNECTED 0x05
115 #define GB_CONTROL_TYPE_DISCONNECTED 0x06
116 #define GB_CONTROL_TYPE_TIMESYNC_ENABLE 0x07
117 #define GB_CONTROL_TYPE_TIMESYNC_DISABLE 0x08
118 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
120 #define GB_CONTROL_TYPE_BUNDLE_VERSION 0x0b
121 #define GB_CONTROL_TYPE_DISCONNECTING 0x0c
122 #define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT 0x0d
123 #define GB_CONTROL_TYPE_MODE_SWITCH 0x0e
124 #define GB_CONTROL_TYPE_BUNDLE_SUSPEND 0x0f
125 #define GB_CONTROL_TYPE_BUNDLE_RESUME 0x10
126 #define GB_CONTROL_TYPE_BUNDLE_DEACTIVATE 0x11
127 #define GB_CONTROL_TYPE_BUNDLE_ACTIVATE 0x12
128 #define GB_CONTROL_TYPE_INTF_SUSPEND_PREPARE 0x13
129 #define GB_CONTROL_TYPE_INTF_DEACTIVATE_PREPARE 0x14
130 #define GB_CONTROL_TYPE_INTF_HIBERNATE_ABORT 0x15
132 struct gb_control_version_request {
137 struct gb_control_version_response {
142 struct gb_control_bundle_version_request {
146 struct gb_control_bundle_version_response {
151 /* Control protocol manifest get size request has no payload*/
152 struct gb_control_get_manifest_size_response {
156 /* Control protocol manifest get request has no payload */
157 struct gb_control_get_manifest_response {
161 /* Control protocol [dis]connected request */
162 struct gb_control_connected_request {
166 struct gb_control_disconnecting_request {
169 /* disconnecting response has no payload */
171 struct gb_control_disconnected_request {
174 /* Control protocol [dis]connected response has no payload */
177 * All Bundle power management operations use the same request and response
178 * layout and status codes.
181 #define GB_CONTROL_BUNDLE_PM_OK 0x00
182 #define GB_CONTROL_BUNDLE_PM_INVAL 0x01
183 #define GB_CONTROL_BUNDLE_PM_BUSY 0x02
184 #define GB_CONTROL_BUNDLE_PM_FAIL 0x03
185 #define GB_CONTROL_BUNDLE_PM_NA 0x04
187 struct gb_control_bundle_pm_request {
191 struct gb_control_bundle_pm_response {
196 * Interface Suspend Prepare and Deactivate Prepare operations use the same
197 * response layout and error codes. Define a single response structure and reuse
198 * it. Both operations have no payload.
201 #define GB_CONTROL_INTF_PM_OK 0x00
202 #define GB_CONTROL_INTF_PM_BUSY 0x01
203 #define GB_CONTROL_INTF_PM_NA 0x02
205 struct gb_control_intf_pm_response {
209 /* APBridge protocol */
211 /* request APB1 log */
212 #define GB_APB_REQUEST_LOG 0x02
214 /* request to map a cport to bulk in and bulk out endpoints */
215 #define GB_APB_REQUEST_EP_MAPPING 0x03
217 /* request to get the number of cports available */
218 #define GB_APB_REQUEST_CPORT_COUNT 0x04
220 /* request to reset a cport state */
221 #define GB_APB_REQUEST_RESET_CPORT 0x05
223 /* request to time the latency of messages on a given cport */
224 #define GB_APB_REQUEST_LATENCY_TAG_EN 0x06
225 #define GB_APB_REQUEST_LATENCY_TAG_DIS 0x07
227 /* request to control the CSI transmitter */
228 #define GB_APB_REQUEST_CSI_TX_CONTROL 0x08
230 /* request to control audio streaming */
231 #define GB_APB_REQUEST_AUDIO_CONTROL 0x09
233 /* TimeSync requests */
234 #define GB_APB_REQUEST_TIMESYNC_ENABLE 0x0d
235 #define GB_APB_REQUEST_TIMESYNC_DISABLE 0x0e
236 #define GB_APB_REQUEST_TIMESYNC_AUTHORITATIVE 0x0f
237 #define GB_APB_REQUEST_TIMESYNC_GET_LAST_EVENT 0x10
239 /* requests to set Greybus CPort flags */
240 #define GB_APB_REQUEST_CPORT_FLAGS 0x11
243 #define GB_APB_REQUEST_ARPC_RUN 0x12
245 struct gb_apb_request_cport_flags {
247 #define GB_APB_CPORT_FLAG_CONTROL 0x01
248 #define GB_APB_CPORT_FLAG_HIGH_PRIO 0x02
252 /* Firmware Download Protocol */
255 #define GB_FW_DOWNLOAD_TYPE_FIND_FIRMWARE 0x01
256 #define GB_FW_DOWNLOAD_TYPE_FETCH_FIRMWARE 0x02
257 #define GB_FW_DOWNLOAD_TYPE_RELEASE_FIRMWARE 0x03
259 #define GB_FIRMWARE_TAG_MAX_SIZE 10
261 /* firmware download find firmware request/response */
262 struct gb_fw_download_find_firmware_request {
263 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE];
266 struct gb_fw_download_find_firmware_response {
271 /* firmware download fetch firmware request/response */
272 struct gb_fw_download_fetch_firmware_request {
278 struct gb_fw_download_fetch_firmware_response {
282 /* firmware download release firmware request */
283 struct gb_fw_download_release_firmware_request {
286 /* firmware download release firmware response has no payload */
289 /* Firmware Management Protocol */
292 #define GB_FW_MGMT_TYPE_INTERFACE_FW_VERSION 0x01
293 #define GB_FW_MGMT_TYPE_LOAD_AND_VALIDATE_FW 0x02
294 #define GB_FW_MGMT_TYPE_LOADED_FW 0x03
295 #define GB_FW_MGMT_TYPE_BACKEND_FW_VERSION 0x04
296 #define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATE 0x05
297 #define GB_FW_MGMT_TYPE_BACKEND_FW_UPDATED 0x06
299 #define GB_FW_LOAD_METHOD_UNIPRO 0x01
300 #define GB_FW_LOAD_METHOD_INTERNAL 0x02
302 #define GB_FW_LOAD_STATUS_FAILED 0x00
303 #define GB_FW_LOAD_STATUS_UNVALIDATED 0x01
304 #define GB_FW_LOAD_STATUS_VALIDATED 0x02
305 #define GB_FW_LOAD_STATUS_VALIDATION_FAILED 0x03
307 #define GB_FW_BACKEND_FW_STATUS_SUCCESS 0x01
308 #define GB_FW_BACKEND_FW_STATUS_FAIL_FIND 0x02
309 #define GB_FW_BACKEND_FW_STATUS_FAIL_FETCH 0x03
310 #define GB_FW_BACKEND_FW_STATUS_FAIL_WRITE 0x04
311 #define GB_FW_BACKEND_FW_STATUS_INT 0x05
312 #define GB_FW_BACKEND_FW_STATUS_RETRY 0x06
313 #define GB_FW_BACKEND_FW_STATUS_NOT_SUPPORTED 0x07
315 #define GB_FW_BACKEND_VERSION_STATUS_SUCCESS 0x01
316 #define GB_FW_BACKEND_VERSION_STATUS_NOT_AVAILABLE 0x02
317 #define GB_FW_BACKEND_VERSION_STATUS_NOT_SUPPORTED 0x03
318 #define GB_FW_BACKEND_VERSION_STATUS_RETRY 0x04
319 #define GB_FW_BACKEND_VERSION_STATUS_FAIL_INT 0x05
321 /* firmware management interface firmware version request has no payload */
322 struct gb_fw_mgmt_interface_fw_version_response {
323 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE];
328 /* firmware management load and validate firmware request/response */
329 struct gb_fw_mgmt_load_and_validate_fw_request {
332 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE];
334 /* firmware management load and validate firmware response has no payload*/
336 /* firmware management loaded firmware request */
337 struct gb_fw_mgmt_loaded_fw_request {
343 /* firmware management loaded firmware response has no payload */
345 /* firmware management backend firmware version request/response */
346 struct gb_fw_mgmt_backend_fw_version_request {
347 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE];
350 struct gb_fw_mgmt_backend_fw_version_response {
356 /* firmware management backend firmware update request */
357 struct gb_fw_mgmt_backend_fw_update_request {
359 __u8 firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE];
361 /* firmware management backend firmware update response has no payload */
363 /* firmware management backend firmware updated request */
364 struct gb_fw_mgmt_backend_fw_updated_request {
368 /* firmware management backend firmware updated response has no payload */
371 /* Component Authentication Protocol (CAP) */
374 #define GB_CAP_TYPE_GET_ENDPOINT_UID 0x01
375 #define GB_CAP_TYPE_GET_IMS_CERTIFICATE 0x02
376 #define GB_CAP_TYPE_AUTHENTICATE 0x03
378 /* CAP get endpoint uid request has no payload */
379 struct gb_cap_get_endpoint_uid_response {
383 /* CAP get endpoint ims certificate request/response */
384 struct gb_cap_get_ims_certificate_request {
385 __le32 certificate_class;
386 __le32 certificate_id;
389 struct gb_cap_get_ims_certificate_response {
394 /* CAP authenticate request/response */
395 struct gb_cap_authenticate_request {
401 struct gb_cap_authenticate_response {
408 /* Bootrom Protocol */
410 /* Version of the Greybus bootrom protocol we support */
411 #define GB_BOOTROM_VERSION_MAJOR 0x00
412 #define GB_BOOTROM_VERSION_MINOR 0x01
414 /* Greybus bootrom request types */
415 #define GB_BOOTROM_TYPE_VERSION 0x01
416 #define GB_BOOTROM_TYPE_FIRMWARE_SIZE 0x02
417 #define GB_BOOTROM_TYPE_GET_FIRMWARE 0x03
418 #define GB_BOOTROM_TYPE_READY_TO_BOOT 0x04
419 #define GB_BOOTROM_TYPE_AP_READY 0x05 /* Request with no-payload */
420 #define GB_BOOTROM_TYPE_GET_VID_PID 0x06 /* Request with no-payload */
422 /* Greybus bootrom boot stages */
423 #define GB_BOOTROM_BOOT_STAGE_ONE 0x01 /* Reserved for the boot ROM */
424 #define GB_BOOTROM_BOOT_STAGE_TWO 0x02 /* Bootrom package to be loaded by the boot ROM */
425 #define GB_BOOTROM_BOOT_STAGE_THREE 0x03 /* Module personality package loaded by Stage 2 firmware */
427 /* Greybus bootrom ready to boot status */
428 #define GB_BOOTROM_BOOT_STATUS_INVALID 0x00 /* Firmware blob could not be validated */
429 #define GB_BOOTROM_BOOT_STATUS_INSECURE 0x01 /* Firmware blob is valid but insecure */
430 #define GB_BOOTROM_BOOT_STATUS_SECURE 0x02 /* Firmware blob is valid and secure */
432 /* Max bootrom data fetch size in bytes */
433 #define GB_BOOTROM_FETCH_MAX 2000
435 struct gb_bootrom_version_request {
440 struct gb_bootrom_version_response {
445 /* Bootrom protocol firmware size request/response */
446 struct gb_bootrom_firmware_size_request {
450 struct gb_bootrom_firmware_size_response {
454 /* Bootrom protocol get firmware request/response */
455 struct gb_bootrom_get_firmware_request {
460 struct gb_bootrom_get_firmware_response {
464 /* Bootrom protocol Ready to boot request */
465 struct gb_bootrom_ready_to_boot_request {
468 /* Bootrom protocol Ready to boot response has no payload */
470 /* Bootrom protocol get VID/PID request has no payload */
471 struct gb_bootrom_get_vid_pid_response {
479 /* Greybus power supply request types */
480 #define GB_POWER_SUPPLY_TYPE_GET_SUPPLIES 0x02
481 #define GB_POWER_SUPPLY_TYPE_GET_DESCRIPTION 0x03
482 #define GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS 0x04
483 #define GB_POWER_SUPPLY_TYPE_GET_PROPERTY 0x05
484 #define GB_POWER_SUPPLY_TYPE_SET_PROPERTY 0x06
485 #define GB_POWER_SUPPLY_TYPE_EVENT 0x07
487 /* Greybus power supply battery technologies types */
488 #define GB_POWER_SUPPLY_TECH_UNKNOWN 0x0000
489 #define GB_POWER_SUPPLY_TECH_NiMH 0x0001
490 #define GB_POWER_SUPPLY_TECH_LION 0x0002
491 #define GB_POWER_SUPPLY_TECH_LIPO 0x0003
492 #define GB_POWER_SUPPLY_TECH_LiFe 0x0004
493 #define GB_POWER_SUPPLY_TECH_NiCd 0x0005
494 #define GB_POWER_SUPPLY_TECH_LiMn 0x0006
496 /* Greybus power supply types */
497 #define GB_POWER_SUPPLY_UNKNOWN_TYPE 0x0000
498 #define GB_POWER_SUPPLY_BATTERY_TYPE 0x0001
499 #define GB_POWER_SUPPLY_UPS_TYPE 0x0002
500 #define GB_POWER_SUPPLY_MAINS_TYPE 0x0003
501 #define GB_POWER_SUPPLY_USB_TYPE 0x0004
502 #define GB_POWER_SUPPLY_USB_DCP_TYPE 0x0005
503 #define GB_POWER_SUPPLY_USB_CDP_TYPE 0x0006
504 #define GB_POWER_SUPPLY_USB_ACA_TYPE 0x0007
506 /* Greybus power supply health values */
507 #define GB_POWER_SUPPLY_HEALTH_UNKNOWN 0x0000
508 #define GB_POWER_SUPPLY_HEALTH_GOOD 0x0001
509 #define GB_POWER_SUPPLY_HEALTH_OVERHEAT 0x0002
510 #define GB_POWER_SUPPLY_HEALTH_DEAD 0x0003
511 #define GB_POWER_SUPPLY_HEALTH_OVERVOLTAGE 0x0004
512 #define GB_POWER_SUPPLY_HEALTH_UNSPEC_FAILURE 0x0005
513 #define GB_POWER_SUPPLY_HEALTH_COLD 0x0006
514 #define GB_POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE 0x0007
515 #define GB_POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE 0x0008
517 /* Greybus power supply status values */
518 #define GB_POWER_SUPPLY_STATUS_UNKNOWN 0x0000
519 #define GB_POWER_SUPPLY_STATUS_CHARGING 0x0001
520 #define GB_POWER_SUPPLY_STATUS_DISCHARGING 0x0002
521 #define GB_POWER_SUPPLY_STATUS_NOT_CHARGING 0x0003
522 #define GB_POWER_SUPPLY_STATUS_FULL 0x0004
524 /* Greybus power supply capacity level values */
525 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN 0x0000
526 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL 0x0001
527 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_LOW 0x0002
528 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL 0x0003
529 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_HIGH 0x0004
530 #define GB_POWER_SUPPLY_CAPACITY_LEVEL_FULL 0x0005
532 /* Greybus power supply scope values */
533 #define GB_POWER_SUPPLY_SCOPE_UNKNOWN 0x0000
534 #define GB_POWER_SUPPLY_SCOPE_SYSTEM 0x0001
535 #define GB_POWER_SUPPLY_SCOPE_DEVICE 0x0002
537 struct gb_power_supply_get_supplies_response {
541 struct gb_power_supply_get_description_request {
545 struct gb_power_supply_get_description_response {
546 __u8 manufacturer[32];
548 __u8 serial_number[32];
550 __u8 properties_count;
553 struct gb_power_supply_props_desc {
555 #define GB_POWER_SUPPLY_PROP_STATUS 0x00
556 #define GB_POWER_SUPPLY_PROP_CHARGE_TYPE 0x01
557 #define GB_POWER_SUPPLY_PROP_HEALTH 0x02
558 #define GB_POWER_SUPPLY_PROP_PRESENT 0x03
559 #define GB_POWER_SUPPLY_PROP_ONLINE 0x04
560 #define GB_POWER_SUPPLY_PROP_AUTHENTIC 0x05
561 #define GB_POWER_SUPPLY_PROP_TECHNOLOGY 0x06
562 #define GB_POWER_SUPPLY_PROP_CYCLE_COUNT 0x07
563 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX 0x08
564 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN 0x09
565 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN 0x0A
566 #define GB_POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN 0x0B
567 #define GB_POWER_SUPPLY_PROP_VOLTAGE_NOW 0x0C
568 #define GB_POWER_SUPPLY_PROP_VOLTAGE_AVG 0x0D
569 #define GB_POWER_SUPPLY_PROP_VOLTAGE_OCV 0x0E
570 #define GB_POWER_SUPPLY_PROP_VOLTAGE_BOOT 0x0F
571 #define GB_POWER_SUPPLY_PROP_CURRENT_MAX 0x10
572 #define GB_POWER_SUPPLY_PROP_CURRENT_NOW 0x11
573 #define GB_POWER_SUPPLY_PROP_CURRENT_AVG 0x12
574 #define GB_POWER_SUPPLY_PROP_CURRENT_BOOT 0x13
575 #define GB_POWER_SUPPLY_PROP_POWER_NOW 0x14
576 #define GB_POWER_SUPPLY_PROP_POWER_AVG 0x15
577 #define GB_POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN 0x16
578 #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN 0x17
579 #define GB_POWER_SUPPLY_PROP_CHARGE_FULL 0x18
580 #define GB_POWER_SUPPLY_PROP_CHARGE_EMPTY 0x19
581 #define GB_POWER_SUPPLY_PROP_CHARGE_NOW 0x1A
582 #define GB_POWER_SUPPLY_PROP_CHARGE_AVG 0x1B
583 #define GB_POWER_SUPPLY_PROP_CHARGE_COUNTER 0x1C
584 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT 0x1D
585 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX 0x1E
586 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE 0x1F
587 #define GB_POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX 0x20
588 #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT 0x21
589 #define GB_POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX 0x22
590 #define GB_POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT 0x23
591 #define GB_POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN 0x24
592 #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN 0x25
593 #define GB_POWER_SUPPLY_PROP_ENERGY_FULL 0x26
594 #define GB_POWER_SUPPLY_PROP_ENERGY_EMPTY 0x27
595 #define GB_POWER_SUPPLY_PROP_ENERGY_NOW 0x28
596 #define GB_POWER_SUPPLY_PROP_ENERGY_AVG 0x29
597 #define GB_POWER_SUPPLY_PROP_CAPACITY 0x2A
598 #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN 0x2B
599 #define GB_POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX 0x2C
600 #define GB_POWER_SUPPLY_PROP_CAPACITY_LEVEL 0x2D
601 #define GB_POWER_SUPPLY_PROP_TEMP 0x2E
602 #define GB_POWER_SUPPLY_PROP_TEMP_MAX 0x2F
603 #define GB_POWER_SUPPLY_PROP_TEMP_MIN 0x30
604 #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MIN 0x31
605 #define GB_POWER_SUPPLY_PROP_TEMP_ALERT_MAX 0x32
606 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT 0x33
607 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN 0x34
608 #define GB_POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX 0x35
609 #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW 0x36
610 #define GB_POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG 0x37
611 #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_NOW 0x38
612 #define GB_POWER_SUPPLY_PROP_TIME_TO_FULL_AVG 0x39
613 #define GB_POWER_SUPPLY_PROP_TYPE 0x3A
614 #define GB_POWER_SUPPLY_PROP_SCOPE 0x3B
615 #define GB_POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT 0x3C
616 #define GB_POWER_SUPPLY_PROP_CALIBRATE 0x3D
620 struct gb_power_supply_get_property_descriptors_request {
624 struct gb_power_supply_get_property_descriptors_response {
625 __u8 properties_count;
626 struct gb_power_supply_props_desc props[];
629 struct gb_power_supply_get_property_request {
634 struct gb_power_supply_get_property_response {
638 struct gb_power_supply_set_property_request {
644 struct gb_power_supply_event_request {
647 #define GB_POWER_SUPPLY_UPDATE 0x01
653 /* Greybus HID operation types */
654 #define GB_HID_TYPE_GET_DESC 0x02
655 #define GB_HID_TYPE_GET_REPORT_DESC 0x03
656 #define GB_HID_TYPE_PWR_ON 0x04
657 #define GB_HID_TYPE_PWR_OFF 0x05
658 #define GB_HID_TYPE_GET_REPORT 0x06
659 #define GB_HID_TYPE_SET_REPORT 0x07
660 #define GB_HID_TYPE_IRQ_EVENT 0x08
663 #define GB_HID_INPUT_REPORT 0
664 #define GB_HID_OUTPUT_REPORT 1
665 #define GB_HID_FEATURE_REPORT 2
667 /* Different request/response structures */
668 /* HID get descriptor response */
669 struct gb_hid_desc_response {
671 __le16 wReportDescLength;
678 /* HID get report request/response */
679 struct gb_hid_get_report_request {
684 /* HID set report request */
685 struct gb_hid_set_report_request {
691 /* HID input report request, via interrupt pipe */
692 struct gb_hid_input_report_request {
699 /* Greybus i2c request types */
700 #define GB_I2C_TYPE_FUNCTIONALITY 0x02
701 #define GB_I2C_TYPE_TRANSFER 0x05
703 /* functionality request has no payload */
704 struct gb_i2c_functionality_response {
705 __le32 functionality;
709 * Outgoing data immediately follows the op count and ops array.
710 * The data for each write (master -> slave) op in the array is sent
711 * in order, with no (e.g. pad) bytes separating them.
713 * Short reads cause the entire transfer request to fail So response
714 * payload consists only of bytes read, and the number of bytes is
715 * exactly what was specified in the corresponding op. Like
716 * outgoing data, the incoming data is in order and contiguous.
718 struct gb_i2c_transfer_op {
724 struct gb_i2c_transfer_request {
726 struct gb_i2c_transfer_op ops[0]; /* op_count of these */
728 struct gb_i2c_transfer_response {
729 __u8 data[0]; /* inbound data */
735 /* Greybus GPIO request types */
736 #define GB_GPIO_TYPE_LINE_COUNT 0x02
737 #define GB_GPIO_TYPE_ACTIVATE 0x03
738 #define GB_GPIO_TYPE_DEACTIVATE 0x04
739 #define GB_GPIO_TYPE_GET_DIRECTION 0x05
740 #define GB_GPIO_TYPE_DIRECTION_IN 0x06
741 #define GB_GPIO_TYPE_DIRECTION_OUT 0x07
742 #define GB_GPIO_TYPE_GET_VALUE 0x08
743 #define GB_GPIO_TYPE_SET_VALUE 0x09
744 #define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a
745 #define GB_GPIO_TYPE_IRQ_TYPE 0x0b
746 #define GB_GPIO_TYPE_IRQ_MASK 0x0c
747 #define GB_GPIO_TYPE_IRQ_UNMASK 0x0d
748 #define GB_GPIO_TYPE_IRQ_EVENT 0x0e
750 #define GB_GPIO_IRQ_TYPE_NONE 0x00
751 #define GB_GPIO_IRQ_TYPE_EDGE_RISING 0x01
752 #define GB_GPIO_IRQ_TYPE_EDGE_FALLING 0x02
753 #define GB_GPIO_IRQ_TYPE_EDGE_BOTH 0x03
754 #define GB_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04
755 #define GB_GPIO_IRQ_TYPE_LEVEL_LOW 0x08
757 /* line count request has no payload */
758 struct gb_gpio_line_count_response {
762 struct gb_gpio_activate_request {
765 /* activate response has no payload */
767 struct gb_gpio_deactivate_request {
770 /* deactivate response has no payload */
772 struct gb_gpio_get_direction_request {
775 struct gb_gpio_get_direction_response {
779 struct gb_gpio_direction_in_request {
782 /* direction in response has no payload */
784 struct gb_gpio_direction_out_request {
788 /* direction out response has no payload */
790 struct gb_gpio_get_value_request {
793 struct gb_gpio_get_value_response {
797 struct gb_gpio_set_value_request {
801 /* set value response has no payload */
803 struct gb_gpio_set_debounce_request {
807 /* debounce response has no payload */
809 struct gb_gpio_irq_type_request {
813 /* irq type response has no payload */
815 struct gb_gpio_irq_mask_request {
818 /* irq mask response has no payload */
820 struct gb_gpio_irq_unmask_request {
823 /* irq unmask response has no payload */
825 /* irq event requests originate on another module and are handled on the AP */
826 struct gb_gpio_irq_event_request {
829 /* irq event has no response */
834 /* Greybus PWM operation types */
835 #define GB_PWM_TYPE_PWM_COUNT 0x02
836 #define GB_PWM_TYPE_ACTIVATE 0x03
837 #define GB_PWM_TYPE_DEACTIVATE 0x04
838 #define GB_PWM_TYPE_CONFIG 0x05
839 #define GB_PWM_TYPE_POLARITY 0x06
840 #define GB_PWM_TYPE_ENABLE 0x07
841 #define GB_PWM_TYPE_DISABLE 0x08
843 /* pwm count request has no payload */
844 struct gb_pwm_count_response {
848 struct gb_pwm_activate_request {
852 struct gb_pwm_deactivate_request {
856 struct gb_pwm_config_request {
862 struct gb_pwm_polarity_request {
867 struct gb_pwm_enable_request {
871 struct gb_pwm_disable_request {
877 /* Should match up with modes in linux/spi/spi.h */
878 #define GB_SPI_MODE_CPHA 0x01 /* clock phase */
879 #define GB_SPI_MODE_CPOL 0x02 /* clock polarity */
880 #define GB_SPI_MODE_MODE_0 (0|0) /* (original MicroWire) */
881 #define GB_SPI_MODE_MODE_1 (0|GB_SPI_MODE_CPHA)
882 #define GB_SPI_MODE_MODE_2 (GB_SPI_MODE_CPOL|0)
883 #define GB_SPI_MODE_MODE_3 (GB_SPI_MODE_CPOL|GB_SPI_MODE_CPHA)
884 #define GB_SPI_MODE_CS_HIGH 0x04 /* chipselect active high? */
885 #define GB_SPI_MODE_LSB_FIRST 0x08 /* per-word bits-on-wire */
886 #define GB_SPI_MODE_3WIRE 0x10 /* SI/SO signals shared */
887 #define GB_SPI_MODE_LOOP 0x20 /* loopback mode */
888 #define GB_SPI_MODE_NO_CS 0x40 /* 1 dev/bus, no chipselect */
889 #define GB_SPI_MODE_READY 0x80 /* slave pulls low to pause */
891 /* Should match up with flags in linux/spi/spi.h */
892 #define GB_SPI_FLAG_HALF_DUPLEX BIT(0) /* can't do full duplex */
893 #define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */
894 #define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */
896 /* Greybus spi operation types */
897 #define GB_SPI_TYPE_MASTER_CONFIG 0x02
898 #define GB_SPI_TYPE_DEVICE_CONFIG 0x03
899 #define GB_SPI_TYPE_TRANSFER 0x04
901 /* mode request has no payload */
902 struct gb_spi_master_config_response {
903 __le32 bits_per_word_mask;
911 struct gb_spi_device_config_request {
915 struct gb_spi_device_config_response {
920 #define GB_SPI_SPI_DEV 0x00
921 #define GB_SPI_SPI_NOR 0x01
922 #define GB_SPI_SPI_MODALIAS 0x02
927 * struct gb_spi_transfer - a read/write buffer pair
928 * @speed_hz: Select a speed other than the device default for this transfer. If
929 * 0 the default (from @spi_device) is used.
930 * @len: size of rx and tx buffers (in bytes)
931 * @delay_usecs: microseconds to delay after this transfer before (optionally)
932 * changing the chipselect status, then starting the next transfer or
933 * completing this spi_message.
934 * @cs_change: affects chipselect after this transfer completes
935 * @bits_per_word: select a bits_per_word other than the device default for this
936 * transfer. If 0 the default (from @spi_device) is used.
938 struct gb_spi_transfer {
945 #define GB_SPI_XFER_READ 0x01
946 #define GB_SPI_XFER_WRITE 0x02
947 #define GB_SPI_XFER_INPROGRESS 0x04
950 struct gb_spi_transfer_request {
951 __u8 chip_select; /* of the spi device */
952 __u8 mode; /* of the spi device */
954 struct gb_spi_transfer transfers[0]; /* count of these */
957 struct gb_spi_transfer_response {
958 __u8 data[0]; /* inbound data */
961 /* Version of the Greybus SVC protocol we support */
962 #define GB_SVC_VERSION_MAJOR 0x00
963 #define GB_SVC_VERSION_MINOR 0x01
965 /* Greybus SVC request types */
966 #define GB_SVC_TYPE_PROTOCOL_VERSION 0x01
967 #define GB_SVC_TYPE_SVC_HELLO 0x02
968 #define GB_SVC_TYPE_INTF_DEVICE_ID 0x03
969 #define GB_SVC_TYPE_INTF_RESET 0x06
970 #define GB_SVC_TYPE_CONN_CREATE 0x07
971 #define GB_SVC_TYPE_CONN_DESTROY 0x08
972 #define GB_SVC_TYPE_DME_PEER_GET 0x09
973 #define GB_SVC_TYPE_DME_PEER_SET 0x0a
974 #define GB_SVC_TYPE_ROUTE_CREATE 0x0b
975 #define GB_SVC_TYPE_ROUTE_DESTROY 0x0c
976 #define GB_SVC_TYPE_TIMESYNC_ENABLE 0x0d
977 #define GB_SVC_TYPE_TIMESYNC_DISABLE 0x0e
978 #define GB_SVC_TYPE_TIMESYNC_AUTHORITATIVE 0x0f
979 #define GB_SVC_TYPE_INTF_SET_PWRM 0x10
980 #define GB_SVC_TYPE_INTF_EJECT 0x11
981 #define GB_SVC_TYPE_PING 0x13
982 #define GB_SVC_TYPE_PWRMON_RAIL_COUNT_GET 0x14
983 #define GB_SVC_TYPE_PWRMON_RAIL_NAMES_GET 0x15
984 #define GB_SVC_TYPE_PWRMON_SAMPLE_GET 0x16
985 #define GB_SVC_TYPE_PWRMON_INTF_SAMPLE_GET 0x17
986 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_ACQUIRE 0x18
987 #define GB_SVC_TYPE_TIMESYNC_WAKE_PINS_RELEASE 0x19
988 #define GB_SVC_TYPE_TIMESYNC_PING 0x1a
989 #define GB_SVC_TYPE_MODULE_INSERTED 0x1f
990 #define GB_SVC_TYPE_MODULE_REMOVED 0x20
991 #define GB_SVC_TYPE_INTF_VSYS_ENABLE 0x21
992 #define GB_SVC_TYPE_INTF_VSYS_DISABLE 0x22
993 #define GB_SVC_TYPE_INTF_REFCLK_ENABLE 0x23
994 #define GB_SVC_TYPE_INTF_REFCLK_DISABLE 0x24
995 #define GB_SVC_TYPE_INTF_UNIPRO_ENABLE 0x25
996 #define GB_SVC_TYPE_INTF_UNIPRO_DISABLE 0x26
997 #define GB_SVC_TYPE_INTF_ACTIVATE 0x27
998 #define GB_SVC_TYPE_INTF_RESUME 0x28
999 #define GB_SVC_TYPE_INTF_MAILBOX_EVENT 0x29
1000 #define GB_SVC_TYPE_INTF_OOPS 0x2a
1002 /* Greybus SVC protocol status values */
1003 #define GB_SVC_OP_SUCCESS 0x00
1004 #define GB_SVC_OP_UNKNOWN_ERROR 0x01
1005 #define GB_SVC_INTF_NOT_DETECTED 0x02
1006 #define GB_SVC_INTF_NO_UPRO_LINK 0x03
1007 #define GB_SVC_INTF_UPRO_NOT_DOWN 0x04
1008 #define GB_SVC_INTF_UPRO_NOT_HIBERNATED 0x05
1009 #define GB_SVC_INTF_NO_V_SYS 0x06
1010 #define GB_SVC_INTF_V_CHG 0x07
1011 #define GB_SVC_INTF_WAKE_BUSY 0x08
1012 #define GB_SVC_INTF_NO_REFCLK 0x09
1013 #define GB_SVC_INTF_RELEASING 0x0a
1014 #define GB_SVC_INTF_NO_ORDER 0x0b
1015 #define GB_SVC_INTF_MBOX_SET 0x0c
1016 #define GB_SVC_INTF_BAD_MBOX 0x0d
1017 #define GB_SVC_INTF_OP_TIMEOUT 0x0e
1018 #define GB_SVC_PWRMON_OP_NOT_PRESENT 0x0f
1020 struct gb_svc_version_request {
1025 struct gb_svc_version_response {
1030 /* SVC protocol hello request */
1031 struct gb_svc_hello_request {
1035 /* hello response has no payload */
1037 struct gb_svc_intf_device_id_request {
1041 /* device id response has no payload */
1043 struct gb_svc_intf_reset_request {
1046 /* interface reset response has no payload */
1048 struct gb_svc_intf_eject_request {
1051 /* interface eject response has no payload */
1053 struct gb_svc_conn_create_request {
1061 /* connection create response has no payload */
1063 struct gb_svc_conn_destroy_request {
1069 /* connection destroy response has no payload */
1071 struct gb_svc_dme_peer_get_request {
1077 struct gb_svc_dme_peer_get_response {
1082 struct gb_svc_dme_peer_set_request {
1089 struct gb_svc_dme_peer_set_response {
1093 /* Greybus init-status values, currently retrieved using DME peer gets. */
1094 #define GB_INIT_SPI_BOOT_STARTED 0x02
1095 #define GB_INIT_TRUSTED_SPI_BOOT_FINISHED 0x03
1096 #define GB_INIT_UNTRUSTED_SPI_BOOT_FINISHED 0x04
1097 #define GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED 0x06
1098 #define GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED 0x09
1099 #define GB_INIT_S2_LOADER_BOOT_STARTED 0x0D
1101 struct gb_svc_route_create_request {
1107 /* route create response has no payload */
1109 struct gb_svc_route_destroy_request {
1113 /* route destroy response has no payload */
1115 /* used for svc_intf_vsys_{enable,disable} */
1116 struct gb_svc_intf_vsys_request {
1120 struct gb_svc_intf_vsys_response {
1122 #define GB_SVC_INTF_VSYS_OK 0x00
1123 /* 0x01 is reserved */
1124 #define GB_SVC_INTF_VSYS_FAIL 0x02
1127 /* used for svc_intf_refclk_{enable,disable} */
1128 struct gb_svc_intf_refclk_request {
1132 struct gb_svc_intf_refclk_response {
1134 #define GB_SVC_INTF_REFCLK_OK 0x00
1135 /* 0x01 is reserved */
1136 #define GB_SVC_INTF_REFCLK_FAIL 0x02
1139 /* used for svc_intf_unipro_{enable,disable} */
1140 struct gb_svc_intf_unipro_request {
1144 struct gb_svc_intf_unipro_response {
1146 #define GB_SVC_INTF_UNIPRO_OK 0x00
1147 /* 0x01 is reserved */
1148 #define GB_SVC_INTF_UNIPRO_FAIL 0x02
1149 #define GB_SVC_INTF_UNIPRO_NOT_OFF 0x03
1152 #define GB_SVC_UNIPRO_FAST_MODE 0x01
1153 #define GB_SVC_UNIPRO_SLOW_MODE 0x02
1154 #define GB_SVC_UNIPRO_FAST_AUTO_MODE 0x04
1155 #define GB_SVC_UNIPRO_SLOW_AUTO_MODE 0x05
1156 #define GB_SVC_UNIPRO_MODE_UNCHANGED 0x07
1157 #define GB_SVC_UNIPRO_HIBERNATE_MODE 0x11
1158 #define GB_SVC_UNIPRO_OFF_MODE 0x12
1160 #define GB_SVC_SMALL_AMPLITUDE 0x01
1161 #define GB_SVC_LARGE_AMPLITUDE 0x02
1163 #define GB_SVC_NO_DE_EMPHASIS 0x00
1164 #define GB_SVC_SMALL_DE_EMPHASIS 0x01
1165 #define GB_SVC_LARGE_DE_EMPHASIS 0x02
1167 #define GB_SVC_PWRM_RXTERMINATION 0x01
1168 #define GB_SVC_PWRM_TXTERMINATION 0x02
1169 #define GB_SVC_PWRM_LINE_RESET 0x04
1170 #define GB_SVC_PWRM_SCRAMBLING 0x20
1172 #define GB_SVC_PWRM_QUIRK_HSSER 0x00000001
1174 #define GB_SVC_UNIPRO_HS_SERIES_A 0x01
1175 #define GB_SVC_UNIPRO_HS_SERIES_B 0x02
1177 #define GB_SVC_SETPWRM_PWR_OK 0x00
1178 #define GB_SVC_SETPWRM_PWR_LOCAL 0x01
1179 #define GB_SVC_SETPWRM_PWR_REMOTE 0x02
1180 #define GB_SVC_SETPWRM_PWR_BUSY 0x03
1181 #define GB_SVC_SETPWRM_PWR_ERROR_CAP 0x04
1182 #define GB_SVC_SETPWRM_PWR_FATAL_ERROR 0x05
1184 struct gb_svc_l2_timer_cfg {
1185 __le16 tsb_fc0_protection_timeout;
1186 __le16 tsb_tc0_replay_timeout;
1187 __le16 tsb_afc0_req_timeout;
1188 __le16 tsb_fc1_protection_timeout;
1189 __le16 tsb_tc1_replay_timeout;
1190 __le16 tsb_afc1_req_timeout;
1191 __le16 reserved_for_tc2[3];
1192 __le16 reserved_for_tc3[3];
1195 struct gb_svc_intf_set_pwrm_request {
1202 __u8 tx_hs_equalizer;
1208 struct gb_svc_l2_timer_cfg local_l2timerdata, remote_l2timerdata;
1211 struct gb_svc_intf_set_pwrm_response {
1215 struct gb_svc_key_event_request {
1217 #define GB_KEYCODE_ARA 0x00
1220 #define GB_SVC_KEY_RELEASED 0x00
1221 #define GB_SVC_KEY_PRESSED 0x01
1224 #define GB_SVC_PWRMON_MAX_RAIL_COUNT 254
1226 struct gb_svc_pwrmon_rail_count_get_response {
1230 #define GB_SVC_PWRMON_RAIL_NAME_BUFSIZE 32
1232 struct gb_svc_pwrmon_rail_names_get_response {
1234 __u8 name[0][GB_SVC_PWRMON_RAIL_NAME_BUFSIZE];
1237 #define GB_SVC_PWRMON_TYPE_CURR 0x01
1238 #define GB_SVC_PWRMON_TYPE_VOL 0x02
1239 #define GB_SVC_PWRMON_TYPE_PWR 0x03
1241 #define GB_SVC_PWRMON_GET_SAMPLE_OK 0x00
1242 #define GB_SVC_PWRMON_GET_SAMPLE_INVAL 0x01
1243 #define GB_SVC_PWRMON_GET_SAMPLE_NOSUPP 0x02
1244 #define GB_SVC_PWRMON_GET_SAMPLE_HWERR 0x03
1246 struct gb_svc_pwrmon_sample_get_request {
1248 __u8 measurement_type;
1251 struct gb_svc_pwrmon_sample_get_response {
1256 struct gb_svc_pwrmon_intf_sample_get_request {
1258 __u8 measurement_type;
1261 struct gb_svc_pwrmon_intf_sample_get_response {
1266 #define GB_SVC_MODULE_INSERTED_FLAG_NO_PRIMARY 0x0001
1268 struct gb_svc_module_inserted_request {
1269 __u8 primary_intf_id;
1273 /* module_inserted response has no payload */
1275 struct gb_svc_module_removed_request {
1276 __u8 primary_intf_id;
1278 /* module_removed response has no payload */
1280 struct gb_svc_intf_activate_request {
1284 #define GB_SVC_INTF_TYPE_UNKNOWN 0x00
1285 #define GB_SVC_INTF_TYPE_DUMMY 0x01
1286 #define GB_SVC_INTF_TYPE_UNIPRO 0x02
1287 #define GB_SVC_INTF_TYPE_GREYBUS 0x03
1289 struct gb_svc_intf_activate_response {
1294 struct gb_svc_intf_resume_request {
1298 struct gb_svc_intf_resume_response {
1302 #define GB_SVC_INTF_MAILBOX_NONE 0x00
1303 #define GB_SVC_INTF_MAILBOX_AP 0x01
1304 #define GB_SVC_INTF_MAILBOX_GREYBUS 0x02
1306 struct gb_svc_intf_mailbox_event_request {
1311 /* intf_mailbox_event response has no payload */
1313 struct gb_svc_intf_oops_request {
1317 /* intf_oops response has no payload */
1322 /* Greybus raw request types */
1323 #define GB_RAW_TYPE_SEND 0x02
1325 struct gb_raw_send_request {
1333 /* Greybus UART operation types */
1334 #define GB_UART_TYPE_SEND_DATA 0x02
1335 #define GB_UART_TYPE_RECEIVE_DATA 0x03 /* Unsolicited data */
1336 #define GB_UART_TYPE_SET_LINE_CODING 0x04
1337 #define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05
1338 #define GB_UART_TYPE_SEND_BREAK 0x06
1339 #define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
1340 #define GB_UART_TYPE_RECEIVE_CREDITS 0x08
1341 #define GB_UART_TYPE_FLUSH_FIFOS 0x09
1343 /* Represents data from AP -> Module */
1344 struct gb_uart_send_data_request {
1349 /* recv-data-request flags */
1350 #define GB_UART_RECV_FLAG_FRAMING 0x01 /* Framing error */
1351 #define GB_UART_RECV_FLAG_PARITY 0x02 /* Parity error */
1352 #define GB_UART_RECV_FLAG_OVERRUN 0x04 /* Overrun error */
1353 #define GB_UART_RECV_FLAG_BREAK 0x08 /* Break */
1355 /* Represents data from Module -> AP */
1356 struct gb_uart_recv_data_request {
1362 struct gb_uart_receive_credits_request {
1366 struct gb_uart_set_line_coding_request {
1369 #define GB_SERIAL_1_STOP_BITS 0
1370 #define GB_SERIAL_1_5_STOP_BITS 1
1371 #define GB_SERIAL_2_STOP_BITS 2
1374 #define GB_SERIAL_NO_PARITY 0
1375 #define GB_SERIAL_ODD_PARITY 1
1376 #define GB_SERIAL_EVEN_PARITY 2
1377 #define GB_SERIAL_MARK_PARITY 3
1378 #define GB_SERIAL_SPACE_PARITY 4
1383 #define GB_SERIAL_AUTO_RTSCTS_EN 0x1
1386 /* output control lines */
1387 #define GB_UART_CTRL_DTR 0x01
1388 #define GB_UART_CTRL_RTS 0x02
1390 struct gb_uart_set_control_line_state_request {
1394 struct gb_uart_set_break_request {
1398 /* input control lines and line errors */
1399 #define GB_UART_CTRL_DCD 0x01
1400 #define GB_UART_CTRL_DSR 0x02
1401 #define GB_UART_CTRL_RI 0x04
1403 struct gb_uart_serial_state_request {
1407 struct gb_uart_serial_flush_request {
1409 #define GB_SERIAL_FLAG_FLUSH_TRANSMITTER 0x01
1410 #define GB_SERIAL_FLAG_FLUSH_RECEIVER 0x02
1415 /* Greybus loopback request types */
1416 #define GB_LOOPBACK_TYPE_PING 0x02
1417 #define GB_LOOPBACK_TYPE_TRANSFER 0x03
1418 #define GB_LOOPBACK_TYPE_SINK 0x04
1421 * Loopback request/response header format should be identical
1422 * to simplify bandwidth and data movement analysis.
1424 struct gb_loopback_transfer_request {
1431 struct gb_loopback_transfer_response {
1439 /* Greybus SDIO operation types */
1440 #define GB_SDIO_TYPE_GET_CAPABILITIES 0x02
1441 #define GB_SDIO_TYPE_SET_IOS 0x03
1442 #define GB_SDIO_TYPE_COMMAND 0x04
1443 #define GB_SDIO_TYPE_TRANSFER 0x05
1444 #define GB_SDIO_TYPE_EVENT 0x06
1446 /* get caps response: request has no payload */
1447 struct gb_sdio_get_caps_response {
1449 #define GB_SDIO_CAP_NONREMOVABLE 0x00000001
1450 #define GB_SDIO_CAP_4_BIT_DATA 0x00000002
1451 #define GB_SDIO_CAP_8_BIT_DATA 0x00000004
1452 #define GB_SDIO_CAP_MMC_HS 0x00000008
1453 #define GB_SDIO_CAP_SD_HS 0x00000010
1454 #define GB_SDIO_CAP_ERASE 0x00000020
1455 #define GB_SDIO_CAP_1_2V_DDR 0x00000040
1456 #define GB_SDIO_CAP_1_8V_DDR 0x00000080
1457 #define GB_SDIO_CAP_POWER_OFF_CARD 0x00000100
1458 #define GB_SDIO_CAP_UHS_SDR12 0x00000200
1459 #define GB_SDIO_CAP_UHS_SDR25 0x00000400
1460 #define GB_SDIO_CAP_UHS_SDR50 0x00000800
1461 #define GB_SDIO_CAP_UHS_SDR104 0x00001000
1462 #define GB_SDIO_CAP_UHS_DDR50 0x00002000
1463 #define GB_SDIO_CAP_DRIVER_TYPE_A 0x00004000
1464 #define GB_SDIO_CAP_DRIVER_TYPE_C 0x00008000
1465 #define GB_SDIO_CAP_DRIVER_TYPE_D 0x00010000
1466 #define GB_SDIO_CAP_HS200_1_2V 0x00020000
1467 #define GB_SDIO_CAP_HS200_1_8V 0x00040000
1468 #define GB_SDIO_CAP_HS400_1_2V 0x00080000
1469 #define GB_SDIO_CAP_HS400_1_8V 0x00100000
1471 /* see possible values below at vdd */
1475 __le16 max_blk_count;
1476 __le16 max_blk_size;
1479 /* set ios request: response has no payload */
1480 struct gb_sdio_set_ios_request {
1483 #define GB_SDIO_VDD_165_195 0x00000001
1484 #define GB_SDIO_VDD_20_21 0x00000002
1485 #define GB_SDIO_VDD_21_22 0x00000004
1486 #define GB_SDIO_VDD_22_23 0x00000008
1487 #define GB_SDIO_VDD_23_24 0x00000010
1488 #define GB_SDIO_VDD_24_25 0x00000020
1489 #define GB_SDIO_VDD_25_26 0x00000040
1490 #define GB_SDIO_VDD_26_27 0x00000080
1491 #define GB_SDIO_VDD_27_28 0x00000100
1492 #define GB_SDIO_VDD_28_29 0x00000200
1493 #define GB_SDIO_VDD_29_30 0x00000400
1494 #define GB_SDIO_VDD_30_31 0x00000800
1495 #define GB_SDIO_VDD_31_32 0x00001000
1496 #define GB_SDIO_VDD_32_33 0x00002000
1497 #define GB_SDIO_VDD_33_34 0x00004000
1498 #define GB_SDIO_VDD_34_35 0x00008000
1499 #define GB_SDIO_VDD_35_36 0x00010000
1502 #define GB_SDIO_BUSMODE_OPENDRAIN 0x00
1503 #define GB_SDIO_BUSMODE_PUSHPULL 0x01
1506 #define GB_SDIO_POWER_OFF 0x00
1507 #define GB_SDIO_POWER_UP 0x01
1508 #define GB_SDIO_POWER_ON 0x02
1509 #define GB_SDIO_POWER_UNDEFINED 0x03
1512 #define GB_SDIO_BUS_WIDTH_1 0x00
1513 #define GB_SDIO_BUS_WIDTH_4 0x02
1514 #define GB_SDIO_BUS_WIDTH_8 0x03
1517 #define GB_SDIO_TIMING_LEGACY 0x00
1518 #define GB_SDIO_TIMING_MMC_HS 0x01
1519 #define GB_SDIO_TIMING_SD_HS 0x02
1520 #define GB_SDIO_TIMING_UHS_SDR12 0x03
1521 #define GB_SDIO_TIMING_UHS_SDR25 0x04
1522 #define GB_SDIO_TIMING_UHS_SDR50 0x05
1523 #define GB_SDIO_TIMING_UHS_SDR104 0x06
1524 #define GB_SDIO_TIMING_UHS_DDR50 0x07
1525 #define GB_SDIO_TIMING_MMC_DDR52 0x08
1526 #define GB_SDIO_TIMING_MMC_HS200 0x09
1527 #define GB_SDIO_TIMING_MMC_HS400 0x0A
1529 __u8 signal_voltage;
1530 #define GB_SDIO_SIGNAL_VOLTAGE_330 0x00
1531 #define GB_SDIO_SIGNAL_VOLTAGE_180 0x01
1532 #define GB_SDIO_SIGNAL_VOLTAGE_120 0x02
1535 #define GB_SDIO_SET_DRIVER_TYPE_B 0x00
1536 #define GB_SDIO_SET_DRIVER_TYPE_A 0x01
1537 #define GB_SDIO_SET_DRIVER_TYPE_C 0x02
1538 #define GB_SDIO_SET_DRIVER_TYPE_D 0x03
1541 /* command request */
1542 struct gb_sdio_command_request {
1545 #define GB_SDIO_RSP_NONE 0x00
1546 #define GB_SDIO_RSP_PRESENT 0x01
1547 #define GB_SDIO_RSP_136 0x02
1548 #define GB_SDIO_RSP_CRC 0x04
1549 #define GB_SDIO_RSP_BUSY 0x08
1550 #define GB_SDIO_RSP_OPCODE 0x10
1553 #define GB_SDIO_CMD_AC 0x00
1554 #define GB_SDIO_CMD_ADTC 0x01
1555 #define GB_SDIO_CMD_BC 0x02
1556 #define GB_SDIO_CMD_BCR 0x03
1563 struct gb_sdio_command_response {
1567 /* transfer request */
1568 struct gb_sdio_transfer_request {
1570 #define GB_SDIO_DATA_WRITE 0x01
1571 #define GB_SDIO_DATA_READ 0x02
1572 #define GB_SDIO_DATA_STREAM 0x04
1579 struct gb_sdio_transfer_response {
1585 /* event request: generated by module and is defined as unidirectional */
1586 struct gb_sdio_event_request {
1588 #define GB_SDIO_CARD_INSERTED 0x01
1589 #define GB_SDIO_CARD_REMOVED 0x02
1590 #define GB_SDIO_WP 0x04
1595 /* Greybus Camera request types */
1596 #define GB_CAMERA_TYPE_CAPABILITIES 0x02
1597 #define GB_CAMERA_TYPE_CONFIGURE_STREAMS 0x03
1598 #define GB_CAMERA_TYPE_CAPTURE 0x04
1599 #define GB_CAMERA_TYPE_FLUSH 0x05
1600 #define GB_CAMERA_TYPE_METADATA 0x06
1602 #define GB_CAMERA_MAX_STREAMS 4
1603 #define GB_CAMERA_MAX_SETTINGS_SIZE 8192
1605 /* Greybus Camera Configure Streams request payload */
1606 struct gb_camera_stream_config_request {
1613 struct gb_camera_configure_streams_request {
1616 #define GB_CAMERA_CONFIGURE_STREAMS_TEST_ONLY 0x01
1618 struct gb_camera_stream_config_request config[0];
1621 /* Greybus Camera Configure Streams response payload */
1622 struct gb_camera_stream_config_response {
1626 __u8 virtual_channel;
1628 __le16 max_pkt_size;
1633 struct gb_camera_configure_streams_response {
1635 #define GB_CAMERA_CONFIGURE_STREAMS_ADJUSTED 0x01
1639 struct gb_camera_stream_config_response config[0];
1642 /* Greybus Camera Capture request payload - response has no payload */
1643 struct gb_camera_capture_request {
1651 /* Greybus Camera Flush response payload - request has no payload */
1652 struct gb_camera_flush_response {
1656 /* Greybus Camera Metadata request payload - operation has no response */
1657 struct gb_camera_metadata_request {
1659 __le16 frame_number;
1667 /* Greybus Lights request types */
1668 #define GB_LIGHTS_TYPE_GET_LIGHTS 0x02
1669 #define GB_LIGHTS_TYPE_GET_LIGHT_CONFIG 0x03
1670 #define GB_LIGHTS_TYPE_GET_CHANNEL_CONFIG 0x04
1671 #define GB_LIGHTS_TYPE_GET_CHANNEL_FLASH_CONFIG 0x05
1672 #define GB_LIGHTS_TYPE_SET_BRIGHTNESS 0x06
1673 #define GB_LIGHTS_TYPE_SET_BLINK 0x07
1674 #define GB_LIGHTS_TYPE_SET_COLOR 0x08
1675 #define GB_LIGHTS_TYPE_SET_FADE 0x09
1676 #define GB_LIGHTS_TYPE_EVENT 0x0A
1677 #define GB_LIGHTS_TYPE_SET_FLASH_INTENSITY 0x0B
1678 #define GB_LIGHTS_TYPE_SET_FLASH_STROBE 0x0C
1679 #define GB_LIGHTS_TYPE_SET_FLASH_TIMEOUT 0x0D
1680 #define GB_LIGHTS_TYPE_GET_FLASH_FAULT 0x0E
1682 /* Greybus Light modes */
1685 * if you add any specific mode below, update also the
1686 * GB_CHANNEL_MODE_DEFINED_RANGE value accordingly
1688 #define GB_CHANNEL_MODE_NONE 0x00000000
1689 #define GB_CHANNEL_MODE_BATTERY 0x00000001
1690 #define GB_CHANNEL_MODE_POWER 0x00000002
1691 #define GB_CHANNEL_MODE_WIRELESS 0x00000004
1692 #define GB_CHANNEL_MODE_BLUETOOTH 0x00000008
1693 #define GB_CHANNEL_MODE_KEYBOARD 0x00000010
1694 #define GB_CHANNEL_MODE_BUTTONS 0x00000020
1695 #define GB_CHANNEL_MODE_NOTIFICATION 0x00000040
1696 #define GB_CHANNEL_MODE_ATTENTION 0x00000080
1697 #define GB_CHANNEL_MODE_FLASH 0x00000100
1698 #define GB_CHANNEL_MODE_TORCH 0x00000200
1699 #define GB_CHANNEL_MODE_INDICATOR 0x00000400
1701 /* Lights Mode valid bit values */
1702 #define GB_CHANNEL_MODE_DEFINED_RANGE 0x000004FF
1703 #define GB_CHANNEL_MODE_VENDOR_RANGE 0x00F00000
1705 /* Greybus Light Channels Flags */
1706 #define GB_LIGHT_CHANNEL_MULTICOLOR 0x00000001
1707 #define GB_LIGHT_CHANNEL_FADER 0x00000002
1708 #define GB_LIGHT_CHANNEL_BLINK 0x00000004
1710 /* get count of lights in module */
1711 struct gb_lights_get_lights_response {
1715 /* light config request payload */
1716 struct gb_lights_get_light_config_request {
1720 /* light config response payload */
1721 struct gb_lights_get_light_config_response {
1726 /* channel config request payload */
1727 struct gb_lights_get_channel_config_request {
1732 /* channel flash config request payload */
1733 struct gb_lights_get_channel_flash_config_request {
1738 /* channel config response payload */
1739 struct gb_lights_get_channel_config_response {
1740 __u8 max_brightness;
1743 __u8 color_name[32];
1748 /* channel flash config response payload */
1749 struct gb_lights_get_channel_flash_config_response {
1750 __le32 intensity_min_uA;
1751 __le32 intensity_max_uA;
1752 __le32 intensity_step_uA;
1753 __le32 timeout_min_us;
1754 __le32 timeout_max_us;
1755 __le32 timeout_step_us;
1758 /* blink request payload: response have no payload */
1759 struct gb_lights_blink_request {
1766 /* set brightness request payload: response have no payload */
1767 struct gb_lights_set_brightness_request {
1773 /* set color request payload: response have no payload */
1774 struct gb_lights_set_color_request {
1780 /* set fade request payload: response have no payload */
1781 struct gb_lights_set_fade_request {
1788 /* event request: generated by module */
1789 struct gb_lights_event_request {
1792 #define GB_LIGHTS_LIGHT_CONFIG 0x01
1795 /* set flash intensity request payload: response have no payload */
1796 struct gb_lights_set_flash_intensity_request {
1799 __le32 intensity_uA;
1802 /* set flash strobe state request payload: response have no payload */
1803 struct gb_lights_set_flash_strobe_request {
1809 /* set flash timeout request payload: response have no payload */
1810 struct gb_lights_set_flash_timeout_request {
1816 /* get flash fault request payload */
1817 struct gb_lights_get_flash_fault_request {
1822 /* get flash fault response payload */
1823 struct gb_lights_get_flash_fault_response {
1825 #define GB_LIGHTS_FLASH_FAULT_OVER_VOLTAGE 0x00000000
1826 #define GB_LIGHTS_FLASH_FAULT_TIMEOUT 0x00000001
1827 #define GB_LIGHTS_FLASH_FAULT_OVER_TEMPERATURE 0x00000002
1828 #define GB_LIGHTS_FLASH_FAULT_SHORT_CIRCUIT 0x00000004
1829 #define GB_LIGHTS_FLASH_FAULT_OVER_CURRENT 0x00000008
1830 #define GB_LIGHTS_FLASH_FAULT_INDICATOR 0x00000010
1831 #define GB_LIGHTS_FLASH_FAULT_UNDER_VOLTAGE 0x00000020
1832 #define GB_LIGHTS_FLASH_FAULT_INPUT_VOLTAGE 0x00000040
1833 #define GB_LIGHTS_FLASH_FAULT_LED_OVER_TEMPERATURE 0x00000080
1838 #define GB_AUDIO_TYPE_GET_TOPOLOGY_SIZE 0x02
1839 #define GB_AUDIO_TYPE_GET_TOPOLOGY 0x03
1840 #define GB_AUDIO_TYPE_GET_CONTROL 0x04
1841 #define GB_AUDIO_TYPE_SET_CONTROL 0x05
1842 #define GB_AUDIO_TYPE_ENABLE_WIDGET 0x06
1843 #define GB_AUDIO_TYPE_DISABLE_WIDGET 0x07
1844 #define GB_AUDIO_TYPE_GET_PCM 0x08
1845 #define GB_AUDIO_TYPE_SET_PCM 0x09
1846 #define GB_AUDIO_TYPE_SET_TX_DATA_SIZE 0x0a
1848 #define GB_AUDIO_TYPE_ACTIVATE_TX 0x0c
1849 #define GB_AUDIO_TYPE_DEACTIVATE_TX 0x0d
1850 #define GB_AUDIO_TYPE_SET_RX_DATA_SIZE 0x0e
1852 #define GB_AUDIO_TYPE_ACTIVATE_RX 0x10
1853 #define GB_AUDIO_TYPE_DEACTIVATE_RX 0x11
1854 #define GB_AUDIO_TYPE_JACK_EVENT 0x12
1855 #define GB_AUDIO_TYPE_BUTTON_EVENT 0x13
1856 #define GB_AUDIO_TYPE_STREAMING_EVENT 0x14
1857 #define GB_AUDIO_TYPE_SEND_DATA 0x15
1859 /* Module must be able to buffer 10ms of audio data, minimum */
1860 #define GB_AUDIO_SAMPLE_BUFFER_MIN_US 10000
1862 #define GB_AUDIO_PCM_NAME_MAX 32
1863 #define AUDIO_DAI_NAME_MAX 32
1864 #define AUDIO_CONTROL_NAME_MAX 32
1865 #define AUDIO_CTL_ELEM_NAME_MAX 44
1866 #define AUDIO_ENUM_NAME_MAX 64
1867 #define AUDIO_WIDGET_NAME_MAX 32
1869 /* See SNDRV_PCM_FMTBIT_* in Linux source */
1870 #define GB_AUDIO_PCM_FMT_S8 BIT(0)
1871 #define GB_AUDIO_PCM_FMT_U8 BIT(1)
1872 #define GB_AUDIO_PCM_FMT_S16_LE BIT(2)
1873 #define GB_AUDIO_PCM_FMT_S16_BE BIT(3)
1874 #define GB_AUDIO_PCM_FMT_U16_LE BIT(4)
1875 #define GB_AUDIO_PCM_FMT_U16_BE BIT(5)
1876 #define GB_AUDIO_PCM_FMT_S24_LE BIT(6)
1877 #define GB_AUDIO_PCM_FMT_S24_BE BIT(7)
1878 #define GB_AUDIO_PCM_FMT_U24_LE BIT(8)
1879 #define GB_AUDIO_PCM_FMT_U24_BE BIT(9)
1880 #define GB_AUDIO_PCM_FMT_S32_LE BIT(10)
1881 #define GB_AUDIO_PCM_FMT_S32_BE BIT(11)
1882 #define GB_AUDIO_PCM_FMT_U32_LE BIT(12)
1883 #define GB_AUDIO_PCM_FMT_U32_BE BIT(13)
1885 /* See SNDRV_PCM_RATE_* in Linux source */
1886 #define GB_AUDIO_PCM_RATE_5512 BIT(0)
1887 #define GB_AUDIO_PCM_RATE_8000 BIT(1)
1888 #define GB_AUDIO_PCM_RATE_11025 BIT(2)
1889 #define GB_AUDIO_PCM_RATE_16000 BIT(3)
1890 #define GB_AUDIO_PCM_RATE_22050 BIT(4)
1891 #define GB_AUDIO_PCM_RATE_32000 BIT(5)
1892 #define GB_AUDIO_PCM_RATE_44100 BIT(6)
1893 #define GB_AUDIO_PCM_RATE_48000 BIT(7)
1894 #define GB_AUDIO_PCM_RATE_64000 BIT(8)
1895 #define GB_AUDIO_PCM_RATE_88200 BIT(9)
1896 #define GB_AUDIO_PCM_RATE_96000 BIT(10)
1897 #define GB_AUDIO_PCM_RATE_176400 BIT(11)
1898 #define GB_AUDIO_PCM_RATE_192000 BIT(12)
1900 #define GB_AUDIO_STREAM_TYPE_CAPTURE 0x1
1901 #define GB_AUDIO_STREAM_TYPE_PLAYBACK 0x2
1903 #define GB_AUDIO_CTL_ELEM_ACCESS_READ BIT(0)
1904 #define GB_AUDIO_CTL_ELEM_ACCESS_WRITE BIT(1)
1906 /* See SNDRV_CTL_ELEM_TYPE_* in Linux source */
1907 #define GB_AUDIO_CTL_ELEM_TYPE_BOOLEAN 0x01
1908 #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER 0x02
1909 #define GB_AUDIO_CTL_ELEM_TYPE_ENUMERATED 0x03
1910 #define GB_AUDIO_CTL_ELEM_TYPE_INTEGER64 0x06
1912 /* See SNDRV_CTL_ELEM_IFACE_* in Linux source */
1913 #define GB_AUDIO_CTL_ELEM_IFACE_CARD 0x00
1914 #define GB_AUDIO_CTL_ELEM_IFACE_HWDEP 0x01
1915 #define GB_AUDIO_CTL_ELEM_IFACE_MIXER 0x02
1916 #define GB_AUDIO_CTL_ELEM_IFACE_PCM 0x03
1917 #define GB_AUDIO_CTL_ELEM_IFACE_RAWMIDI 0x04
1918 #define GB_AUDIO_CTL_ELEM_IFACE_TIMER 0x05
1919 #define GB_AUDIO_CTL_ELEM_IFACE_SEQUENCER 0x06
1921 /* SNDRV_CTL_ELEM_ACCESS_* in Linux source */
1922 #define GB_AUDIO_ACCESS_READ BIT(0)
1923 #define GB_AUDIO_ACCESS_WRITE BIT(1)
1924 #define GB_AUDIO_ACCESS_VOLATILE BIT(2)
1925 #define GB_AUDIO_ACCESS_TIMESTAMP BIT(3)
1926 #define GB_AUDIO_ACCESS_TLV_READ BIT(4)
1927 #define GB_AUDIO_ACCESS_TLV_WRITE BIT(5)
1928 #define GB_AUDIO_ACCESS_TLV_COMMAND BIT(6)
1929 #define GB_AUDIO_ACCESS_INACTIVE BIT(7)
1930 #define GB_AUDIO_ACCESS_LOCK BIT(8)
1931 #define GB_AUDIO_ACCESS_OWNER BIT(9)
1933 /* enum snd_soc_dapm_type */
1934 #define GB_AUDIO_WIDGET_TYPE_INPUT 0x0
1935 #define GB_AUDIO_WIDGET_TYPE_OUTPUT 0x1
1936 #define GB_AUDIO_WIDGET_TYPE_MUX 0x2
1937 #define GB_AUDIO_WIDGET_TYPE_VIRT_MUX 0x3
1938 #define GB_AUDIO_WIDGET_TYPE_VALUE_MUX 0x4
1939 #define GB_AUDIO_WIDGET_TYPE_MIXER 0x5
1940 #define GB_AUDIO_WIDGET_TYPE_MIXER_NAMED_CTL 0x6
1941 #define GB_AUDIO_WIDGET_TYPE_PGA 0x7
1942 #define GB_AUDIO_WIDGET_TYPE_OUT_DRV 0x8
1943 #define GB_AUDIO_WIDGET_TYPE_ADC 0x9
1944 #define GB_AUDIO_WIDGET_TYPE_DAC 0xa
1945 #define GB_AUDIO_WIDGET_TYPE_MICBIAS 0xb
1946 #define GB_AUDIO_WIDGET_TYPE_MIC 0xc
1947 #define GB_AUDIO_WIDGET_TYPE_HP 0xd
1948 #define GB_AUDIO_WIDGET_TYPE_SPK 0xe
1949 #define GB_AUDIO_WIDGET_TYPE_LINE 0xf
1950 #define GB_AUDIO_WIDGET_TYPE_SWITCH 0x10
1951 #define GB_AUDIO_WIDGET_TYPE_VMID 0x11
1952 #define GB_AUDIO_WIDGET_TYPE_PRE 0x12
1953 #define GB_AUDIO_WIDGET_TYPE_POST 0x13
1954 #define GB_AUDIO_WIDGET_TYPE_SUPPLY 0x14
1955 #define GB_AUDIO_WIDGET_TYPE_REGULATOR_SUPPLY 0x15
1956 #define GB_AUDIO_WIDGET_TYPE_CLOCK_SUPPLY 0x16
1957 #define GB_AUDIO_WIDGET_TYPE_AIF_IN 0x17
1958 #define GB_AUDIO_WIDGET_TYPE_AIF_OUT 0x18
1959 #define GB_AUDIO_WIDGET_TYPE_SIGGEN 0x19
1960 #define GB_AUDIO_WIDGET_TYPE_DAI_IN 0x1a
1961 #define GB_AUDIO_WIDGET_TYPE_DAI_OUT 0x1b
1962 #define GB_AUDIO_WIDGET_TYPE_DAI_LINK 0x1c
1964 #define GB_AUDIO_WIDGET_STATE_DISABLED 0x01
1965 #define GB_AUDIO_WIDGET_STATE_ENAABLED 0x02
1967 #define GB_AUDIO_JACK_EVENT_INSERTION 0x1
1968 #define GB_AUDIO_JACK_EVENT_REMOVAL 0x2
1970 #define GB_AUDIO_BUTTON_EVENT_PRESS 0x1
1971 #define GB_AUDIO_BUTTON_EVENT_RELEASE 0x2
1973 #define GB_AUDIO_STREAMING_EVENT_UNSPECIFIED 0x1
1974 #define GB_AUDIO_STREAMING_EVENT_HALT 0x2
1975 #define GB_AUDIO_STREAMING_EVENT_INTERNAL_ERROR 0x3
1976 #define GB_AUDIO_STREAMING_EVENT_PROTOCOL_ERROR 0x4
1977 #define GB_AUDIO_STREAMING_EVENT_FAILURE 0x5
1978 #define GB_AUDIO_STREAMING_EVENT_UNDERRUN 0x6
1979 #define GB_AUDIO_STREAMING_EVENT_OVERRUN 0x7
1980 #define GB_AUDIO_STREAMING_EVENT_CLOCKING 0x8
1981 #define GB_AUDIO_STREAMING_EVENT_DATA_LEN 0x9
1983 #define GB_AUDIO_INVALID_INDEX 0xff
1985 /* enum snd_jack_types */
1986 #define GB_AUDIO_JACK_HEADPHONE 0x0000001
1987 #define GB_AUDIO_JACK_MICROPHONE 0x0000002
1988 #define GB_AUDIO_JACK_HEADSET (GB_AUDIO_JACK_HEADPHONE | \
1989 GB_AUDIO_JACK_MICROPHONE)
1990 #define GB_AUDIO_JACK_LINEOUT 0x0000004
1991 #define GB_AUDIO_JACK_MECHANICAL 0x0000008
1992 #define GB_AUDIO_JACK_VIDEOOUT 0x0000010
1993 #define GB_AUDIO_JACK_AVOUT (GB_AUDIO_JACK_LINEOUT | \
1994 GB_AUDIO_JACK_VIDEOOUT)
1995 #define GB_AUDIO_JACK_LINEIN 0x0000020
1996 #define GB_AUDIO_JACK_OC_HPHL 0x0000040
1997 #define GB_AUDIO_JACK_OC_HPHR 0x0000080
1998 #define GB_AUDIO_JACK_MICROPHONE2 0x0000200
1999 #define GB_AUDIO_JACK_ANC_HEADPHONE (GB_AUDIO_JACK_HEADPHONE | \
2000 GB_AUDIO_JACK_MICROPHONE | \
2001 GB_AUDIO_JACK_MICROPHONE2)
2002 /* Kept separate from switches to facilitate implementation */
2003 #define GB_AUDIO_JACK_BTN_0 0x4000000
2004 #define GB_AUDIO_JACK_BTN_1 0x2000000
2005 #define GB_AUDIO_JACK_BTN_2 0x1000000
2006 #define GB_AUDIO_JACK_BTN_3 0x0800000
2008 struct gb_audio_pcm {
2009 __u8 stream_name[GB_AUDIO_PCM_NAME_MAX];
2010 __le32 formats; /* GB_AUDIO_PCM_FMT_* */
2011 __le32 rates; /* GB_AUDIO_PCM_RATE_* */
2014 __u8 sig_bits; /* number of bits of content */
2017 struct gb_audio_dai {
2018 __u8 name[AUDIO_DAI_NAME_MAX];
2020 struct gb_audio_pcm capture;
2021 struct gb_audio_pcm playback;
2024 struct gb_audio_integer {
2030 struct gb_audio_integer64 {
2036 struct gb_audio_enumerated {
2038 __le16 names_length;
2042 struct gb_audio_ctl_elem_info { /* See snd_ctl_elem_info in Linux source */
2043 __u8 type; /* GB_AUDIO_CTL_ELEM_TYPE_* */
2046 struct gb_audio_integer integer;
2047 struct gb_audio_integer64 integer64;
2048 struct gb_audio_enumerated enumerated;
2052 struct gb_audio_ctl_elem_value { /* See snd_ctl_elem_value in Linux source */
2053 __le64 timestamp; /* XXX needed? */
2055 __le32 integer_value[2]; /* consider CTL_DOUBLE_xxx */
2056 __le64 integer64_value[2];
2057 __le32 enumerated_item[2];
2061 struct gb_audio_control {
2062 __u8 name[AUDIO_CONTROL_NAME_MAX];
2064 __u8 iface; /* GB_AUDIO_IFACE_* */
2066 __le32 access; /* GB_AUDIO_ACCESS_* */
2067 __u8 count; /* count of same elements */
2068 __u8 count_values; /* count of values, max=2 for CTL_DOUBLE_xxx */
2069 struct gb_audio_ctl_elem_info info;
2072 struct gb_audio_widget {
2073 __u8 name[AUDIO_WIDGET_NAME_MAX];
2074 __u8 sname[AUDIO_WIDGET_NAME_MAX];
2076 __u8 type; /* GB_AUDIO_WIDGET_TYPE_* */
2077 __u8 state; /* GB_AUDIO_WIDGET_STATE_* */
2079 struct gb_audio_control ctl[0]; /* 'ncontrols' entries */
2082 struct gb_audio_route {
2083 __u8 source_id; /* widget id */
2084 __u8 destination_id; /* widget id */
2085 __u8 control_id; /* 0-63 */
2086 __u8 index; /* Selection within the control */
2089 struct gb_audio_topology {
2095 __le32 size_controls;
2096 __le32 size_widgets;
2100 * struct gb_audio_dai dai[num_dais];
2101 * struct gb_audio_control controls[num_controls];
2102 * struct gb_audio_widget widgets[num_widgets];
2103 * struct gb_audio_route routes[num_routes];
2108 struct gb_audio_get_topology_size_response {
2112 struct gb_audio_get_topology_response {
2113 struct gb_audio_topology topology;
2116 struct gb_audio_get_control_request {
2121 struct gb_audio_get_control_response {
2122 struct gb_audio_ctl_elem_value value;
2125 struct gb_audio_set_control_request {
2128 struct gb_audio_ctl_elem_value value;
2131 struct gb_audio_enable_widget_request {
2135 struct gb_audio_disable_widget_request {
2139 struct gb_audio_get_pcm_request {
2143 struct gb_audio_get_pcm_response {
2150 struct gb_audio_set_pcm_request {
2158 struct gb_audio_set_tx_data_size_request {
2163 struct gb_audio_activate_tx_request {
2167 struct gb_audio_deactivate_tx_request {
2171 struct gb_audio_set_rx_data_size_request {
2176 struct gb_audio_activate_rx_request {
2180 struct gb_audio_deactivate_rx_request {
2184 struct gb_audio_jack_event_request {
2186 __u8 jack_attribute;
2190 struct gb_audio_button_event_request {
2196 struct gb_audio_streaming_event_request {
2201 struct gb_audio_send_data_request {
2210 #define GB_LOG_TYPE_SEND_LOG 0x02
2213 #define GB_LOG_MAX_LEN 1024
2215 struct gb_log_send_log_request {
2220 #endif /* __GREYBUS_PROTOCOLS_H */