blob: 8ffeb172e4d5b9f21261d7e80eb5d577a5e32966 [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
Greg Kroah-Hartman48123e02014-09-02 10:51:56 -070013#pragma pack(push, 1)
14
Alex Elder05ad1892014-09-09 13:55:03 -050015struct greybus_manifest_header {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070016 __le16 size;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070017 __u8 version_major;
18 __u8 version_minor;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070019};
20
21enum greybus_descriptor_type {
22 GREYBUS_TYPE_INVALID = 0x0000,
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070023 GREYBUS_TYPE_FUNCTION = 0x0001,
Matt Porter6d63ff72014-09-26 20:49:48 -050024 GREYBUS_TYPE_MODULE = 0x0002,
Greg Kroah-Hartman526c5c82014-09-01 16:03:31 -070025 GREYBUS_TYPE_STRING = 0x0004,
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070026 GREYBUS_TYPE_CPORT = 0x0005,
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070027};
28
29struct greybus_descriptor_header {
30 __le16 size;
31 __le16 type; /* enum greybus_descriptor_type */
32};
33
Matt Porter097724c2014-09-26 20:49:50 -050034enum greybus_function_type {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070035 GREYBUS_FUNCTION_CONTROL = 0x00,
36 GREYBUS_FUNCTION_USB = 0x01,
37 GREYBUS_FUNCTION_GPIO = 0x02,
38 GREYBUS_FUNCTION_SPI = 0x03,
39 GREYBUS_FUNCTION_UART = 0x04,
40 GREYBUS_FUNCTION_PWM = 0x05,
41 GREYBUS_FUNCTION_I2S = 0x06,
42 GREYBUS_FUNCTION_I2C = 0x07,
43 GREYBUS_FUNCTION_SDIO = 0x08,
44 GREYBUS_FUNCTION_HID = 0x09,
45 GREYBUS_FUNCTION_DISPLAY = 0x0a,
46 GREYBUS_FUNCTION_CAMERA = 0x0b,
47 GREYBUS_FUNCTION_SENSOR = 0x0c,
48 GREYBUS_FUNCTION_VENDOR = 0xff,
49};
50
51struct greybus_descriptor_function {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070052 __le16 cport;
Matt Porter097724c2014-09-26 20:49:50 -050053 __u8 function_type; /* enum greybus_function_type */
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070054};
55
Matt Porter6d63ff72014-09-26 20:49:48 -050056struct greybus_descriptor_module {
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070057 __le16 vendor;
58 __le16 product;
59 __le16 version;
Matt Porter4fc64542014-09-26 20:49:49 -050060 __le64 serial_number;
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070061 __u8 vendor_stringid;
62 __u8 product_stringid;
63};
64
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070065struct greybus_descriptor_string {
Matt Portercbd0fd72014-09-26 20:49:51 -050066 __u8 length;
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070067 __u8 id;
68 __u8 string[0];
69};
70
71struct greybus_descriptor_cport {
72 __le16 number;
73 __le16 size;
74 __u8 speed; // FIXME
75 __u8 reserved;
76};
77
Greg Kroah-Hartman6dca7b92014-09-01 13:42:43 -070078struct greybus_descriptor {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070079 struct greybus_descriptor_header header;
80 union {
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070081 struct greybus_descriptor_function function;
Matt Porter6d63ff72014-09-26 20:49:48 -050082 struct greybus_descriptor_module module;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070083 struct greybus_descriptor_string string;
84 struct greybus_descriptor_cport cport;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070085 };
86};
87
Alex Elderbadad682014-09-09 13:55:04 -050088struct greybus_manifest {
89 struct greybus_manifest_header header;
90 struct greybus_descriptor descriptors[0];
91};
92
Greg Kroah-Hartman48123e02014-09-02 10:51:56 -070093#pragma pack(pop)
94
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070095#endif /* __GREYBUS_DESC_H */