blob: 30995e57772d5cd6846f4534936191469dc74fec [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,
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
28struct greybus_descriptor_header {
29 __le16 size;
30 __le16 type; /* enum greybus_descriptor_type */
31};
32
33
34struct greybus_descriptor_deviceid {
35 __le16 vendor;
36 __le16 product;
37 __le16 version;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070038 __u8 vendor_stringid;
39 __u8 product_stringid;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070040};
41
42struct greybus_descriptor_serial_number {
43 __le64 serial_number;
44};
45
46struct greybus_descriptor_string {
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070047 __u8 id;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070048 __le16 length;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070049 __u8 string[0];
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070050};
51
52struct greybus_descriptor_cport {
53 __le16 number;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070054 __u8 speed; // FIXME
55 __u8 reserved;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070056};
57
58enum 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
75struct greybus_descriptor_function {
76 __le16 number;
77 __le16 cport;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070078 __u8 function_class; /* enum greybus_function_class */
79 __u8 function_subclass;
80 __u8 function_protocol;
81 __u8 reserved;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070082};
83
84struct 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 */