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, |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 21 | GREYBUS_TYPE_FUNCTION = 0x0001, |
| 22 | GREYBUS_TYPE_MODULE_ID = 0x0002, |
| 23 | GREYBUS_TYPE_SERIAL_NUMBER = 0x0003, |
| 24 | GREYBUS_TYPE_DEVICE_STRING = 0x0004, |
| 25 | GREYBUS_TYPE_CPORT = 0x0005, |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | struct greybus_descriptor_header { |
| 29 | __le16 size; |
| 30 | __le16 type; /* enum greybus_descriptor_type */ |
| 31 | }; |
| 32 | |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 33 | enum greybus_function_class { |
| 34 | GREYBUS_FUNCTION_CONTROL = 0x00, |
| 35 | GREYBUS_FUNCTION_USB = 0x01, |
| 36 | GREYBUS_FUNCTION_GPIO = 0x02, |
| 37 | GREYBUS_FUNCTION_SPI = 0x03, |
| 38 | GREYBUS_FUNCTION_UART = 0x04, |
| 39 | GREYBUS_FUNCTION_PWM = 0x05, |
| 40 | GREYBUS_FUNCTION_I2S = 0x06, |
| 41 | GREYBUS_FUNCTION_I2C = 0x07, |
| 42 | GREYBUS_FUNCTION_SDIO = 0x08, |
| 43 | GREYBUS_FUNCTION_HID = 0x09, |
| 44 | GREYBUS_FUNCTION_DISPLAY = 0x0a, |
| 45 | GREYBUS_FUNCTION_CAMERA = 0x0b, |
| 46 | GREYBUS_FUNCTION_SENSOR = 0x0c, |
| 47 | GREYBUS_FUNCTION_VENDOR = 0xff, |
| 48 | }; |
| 49 | |
| 50 | struct greybus_descriptor_function { |
| 51 | __le16 number; |
| 52 | __le16 cport; |
Greg Kroah-Hartman | 3772f16 | 2014-09-01 09:51:33 -0700 | [diff] [blame] | 53 | __u8 function_class; /* enum greybus_function_class */ |
| 54 | __u8 function_subclass; |
| 55 | __u8 function_protocol; |
| 56 | __u8 reserved; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 59 | struct greybus_descriptor_module_id { |
| 60 | __le16 vendor; |
| 61 | __le16 product; |
| 62 | __le16 version; |
| 63 | __u8 vendor_stringid; |
| 64 | __u8 product_stringid; |
| 65 | }; |
| 66 | |
| 67 | struct greybus_descriptor_serial_number { |
| 68 | __le64 serial_number; |
| 69 | }; |
| 70 | |
| 71 | struct greybus_descriptor_string { |
| 72 | __le16 length; |
| 73 | __u8 id; |
| 74 | __u8 string[0]; |
| 75 | }; |
| 76 | |
| 77 | struct greybus_descriptor_cport { |
| 78 | __le16 number; |
| 79 | __le16 size; |
| 80 | __u8 speed; // FIXME |
| 81 | __u8 reserved; |
| 82 | }; |
| 83 | |
Greg Kroah-Hartman | 6dca7b9 | 2014-09-01 13:42:43 -0700 | [diff] [blame^] | 84 | struct greybus_descriptor { |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 85 | struct greybus_descriptor_header header; |
| 86 | union { |
Greg Kroah-Hartman | d587780 | 2014-09-01 10:59:08 -0700 | [diff] [blame] | 87 | struct greybus_descriptor_function function; |
| 88 | struct greybus_descriptor_module_id module_id; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 89 | struct greybus_descriptor_serial_number serial_number; |
| 90 | struct greybus_descriptor_string string; |
| 91 | struct greybus_descriptor_cport cport; |
Greg Kroah-Hartman | 80ebe8a | 2014-08-31 18:08:52 -0700 | [diff] [blame] | 92 | }; |
| 93 | }; |
| 94 | |
| 95 | #endif /* __GREYBUS_DESC_H */ |