blob: ae962d519ee101a5459ccc9f80fc3bbecfb0b14a [file] [log] [blame]
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -07001/*
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
13struct greybus_decriptor_block_header {
14 __le16 size;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070015 __u8 version_major;
16 __u8 version_minor;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070017};
18
19enum greybus_descriptor_type {
20 GREYBUS_TYPE_INVALID = 0x0000,
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070021 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-Hartman80ebe8a2014-08-31 18:08:52 -070026};
27
28struct greybus_descriptor_header {
29 __le16 size;
30 __le16 type; /* enum greybus_descriptor_type */
31};
32
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070033enum 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
50struct greybus_descriptor_function {
51 __le16 number;
52 __le16 cport;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070053 __u8 function_class; /* enum greybus_function_class */
54 __u8 function_subclass;
55 __u8 function_protocol;
56 __u8 reserved;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070057};
58
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070059struct greybus_descriptor_module_id {
60 __le16 vendor;
61 __le16 product;
62 __le16 version;
63 __u8 vendor_stringid;
64 __u8 product_stringid;
65};
66
67struct greybus_descriptor_serial_number {
68 __le64 serial_number;
69};
70
71struct greybus_descriptor_string {
72 __le16 length;
73 __u8 id;
74 __u8 string[0];
75};
76
77struct greybus_descriptor_cport {
78 __le16 number;
79 __le16 size;
80 __u8 speed; // FIXME
81 __u8 reserved;
82};
83
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070084struct greybus_msg_descriptor {
85 struct greybus_descriptor_header header;
86 union {
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070087 struct greybus_descriptor_function function;
88 struct greybus_descriptor_module_id module_id;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070089 struct greybus_descriptor_serial_number serial_number;
90 struct greybus_descriptor_string string;
91 struct greybus_descriptor_cport cport;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070092 };
93};
94
95#endif /* __GREYBUS_DESC_H */