Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Greybus device descriptor definition |
| 3 | * |
| 4 | * Defined in the "Greybus Application Protocol" document. |
| 5 | * See that document for any details on these values and structures. |
| 6 | * |
| 7 | * Copyright 2014 Google Inc. |
| 8 | */ |
| 9 | |
| 10 | #ifndef __GREYBUS_DESC_H |
| 11 | #define __GREYBUS_DESC_H |
| 12 | |
| 13 | struct greybus_decriptor_block_header { |
| 14 | __le16 size; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame^] | 15 | __u8 version_major; |
| 16 | __u8 version_minor; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | enum greybus_descriptor_type { |
| 20 | GREYBUS_TYPE_INVALID = 0x0000, |
| 21 | GREYBUS_TYPE_DEVICE_ID = 0x0001, |
| 22 | GREYBUS_TYPE_SERIAL_NUMBER = 0x0002, |
| 23 | GREYBUS_TYPE_DEVICE_STRING = 0x0003, |
| 24 | GREYBUS_TYPE_CPORT = 0x0004, |
| 25 | GREYBUS_TYPE_FUNCTION = 0x0005, |
| 26 | }; |
| 27 | |
| 28 | struct greybus_descriptor_header { |
| 29 | __le16 size; |
| 30 | __le16 type; /* enum greybus_descriptor_type */ |
| 31 | }; |
| 32 | |
| 33 | |
| 34 | struct greybus_descriptor_deviceid { |
| 35 | __le16 vendor; |
| 36 | __le16 product; |
| 37 | __le16 version; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame^] | 38 | __u8 vendor_stringid; |
| 39 | __u8 product_stringid; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | struct greybus_descriptor_serial_number { |
| 43 | __le64 serial_number; |
| 44 | }; |
| 45 | |
| 46 | struct greybus_descriptor_string { |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame^] | 47 | __u8 id; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 48 | __le16 length; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame^] | 49 | __u8 string[0]; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | struct greybus_descriptor_cport { |
| 53 | __le16 number; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame^] | 54 | __u8 speed; // FIXME |
| 55 | __u8 reserved; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | enum greybus_function_class { |
| 59 | GREYBUS_FUNCTION_CONTROL = 0x00, |
| 60 | GREYBUS_FUNCTION_USB = 0x01, |
| 61 | GREYBUS_FUNCTION_GPIO = 0x02, |
| 62 | GREYBUS_FUNCTION_SPI = 0x03, |
| 63 | GREYBUS_FUNCTION_UART = 0x04, |
| 64 | GREYBUS_FUNCTION_PWM = 0x05, |
| 65 | GREYBUS_FUNCTION_I2S = 0x06, |
| 66 | GREYBUS_FUNCTION_I2C = 0x07, |
| 67 | GREYBUS_FUNCTION_SDIO = 0x08, |
| 68 | GREYBUS_FUNCTION_HID = 0x09, |
| 69 | GREYBUS_FUNCTION_DISPLAY = 0x0a, |
| 70 | GREYBUS_FUNCTION_CAMERA = 0x0b, |
| 71 | GREYBUS_FUNCTION_SENSOR = 0x0c, |
| 72 | GREYBUS_FUNCTION_VENDOR = 0xff, |
| 73 | }; |
| 74 | |
| 75 | struct greybus_descriptor_function { |
| 76 | __le16 number; |
| 77 | __le16 cport; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame^] | 78 | __u8 function_class; /* enum greybus_function_class */ |
| 79 | __u8 function_subclass; |
| 80 | __u8 function_protocol; |
| 81 | __u8 reserved; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | struct greybus_msg_descriptor { |
| 85 | struct greybus_descriptor_header header; |
| 86 | union { |
| 87 | struct greybus_descriptor_deviceid device_id; |
| 88 | struct greybus_descriptor_serial_number serial_number; |
| 89 | struct greybus_descriptor_string string; |
| 90 | struct greybus_descriptor_cport cport; |
| 91 | struct greybus_descriptor_function function; |
| 92 | }; |
| 93 | }; |
| 94 | |
| 95 | #endif /* __GREYBUS_DESC_H */ |