blob: 8b4acd3c2fc13c6266774c25dcaf3a2a7334ee98 [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,
24 GREYBUS_TYPE_MODULE_ID = 0x0002,
25 GREYBUS_TYPE_SERIAL_NUMBER = 0x0003,
Greg Kroah-Hartman526c5c82014-09-01 16:03:31 -070026 GREYBUS_TYPE_STRING = 0x0004,
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070027 GREYBUS_TYPE_CPORT = 0x0005,
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070028};
29
30struct greybus_descriptor_header {
31 __le16 size;
32 __le16 type; /* enum greybus_descriptor_type */
33};
34
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070035enum greybus_function_class {
36 GREYBUS_FUNCTION_CONTROL = 0x00,
37 GREYBUS_FUNCTION_USB = 0x01,
38 GREYBUS_FUNCTION_GPIO = 0x02,
39 GREYBUS_FUNCTION_SPI = 0x03,
40 GREYBUS_FUNCTION_UART = 0x04,
41 GREYBUS_FUNCTION_PWM = 0x05,
42 GREYBUS_FUNCTION_I2S = 0x06,
43 GREYBUS_FUNCTION_I2C = 0x07,
44 GREYBUS_FUNCTION_SDIO = 0x08,
45 GREYBUS_FUNCTION_HID = 0x09,
46 GREYBUS_FUNCTION_DISPLAY = 0x0a,
47 GREYBUS_FUNCTION_CAMERA = 0x0b,
48 GREYBUS_FUNCTION_SENSOR = 0x0c,
49 GREYBUS_FUNCTION_VENDOR = 0xff,
50};
51
52struct greybus_descriptor_function {
53 __le16 number;
54 __le16 cport;
Greg Kroah-Hartmanb94295e2014-09-01 18:34:28 -070055 __u8 class; /* enum greybus_function_class */
56 __u8 subclass;
57 __u8 protocol;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070058 __u8 reserved;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070059};
60
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070061struct greybus_descriptor_module_id {
62 __le16 vendor;
63 __le16 product;
64 __le16 version;
65 __u8 vendor_stringid;
66 __u8 product_stringid;
67};
68
69struct greybus_descriptor_serial_number {
70 __le64 serial_number;
71};
72
73struct greybus_descriptor_string {
74 __le16 length;
75 __u8 id;
76 __u8 string[0];
77};
78
79struct greybus_descriptor_cport {
80 __le16 number;
81 __le16 size;
82 __u8 speed; // FIXME
83 __u8 reserved;
84};
85
Greg Kroah-Hartman6dca7b92014-09-01 13:42:43 -070086struct greybus_descriptor {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070087 struct greybus_descriptor_header header;
88 union {
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070089 struct greybus_descriptor_function function;
90 struct greybus_descriptor_module_id module_id;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070091 struct greybus_descriptor_serial_number serial_number;
92 struct greybus_descriptor_string string;
93 struct greybus_descriptor_cport cport;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070094 };
95};
96
Alex Elderbadad682014-09-09 13:55:04 -050097struct greybus_manifest {
98 struct greybus_manifest_header header;
99 struct greybus_descriptor descriptors[0];
100};
101
Greg Kroah-Hartman48123e02014-09-02 10:51:56 -0700102#pragma pack(pop)
103
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -0700104#endif /* __GREYBUS_DESC_H */