blob: 8865beec9bed68cfce9ab135c7a7607eb2b887d5 [file] [log] [blame]
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -07001/*
Alex Elder908a85d2014-09-24 05:16:16 -05002 * Greybus module manifest definition
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -07003 *
Alex Eldercb705e02014-09-24 05:16:17 -05004 * See "Greybus Application Protocol" document (version 0.1) for
Alex Elder908a85d2014-09-24 05:16:16 -05005 * details on these values and structures.
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -07006 *
7 * Copyright 2014 Google Inc.
Alex Elder908a85d2014-09-24 05:16:16 -05008 *
9 * Released under the GPLv2 only.
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070010 */
11
12#ifndef __GREYBUS_DESC_H
13#define __GREYBUS_DESC_H
14
Greg Kroah-Hartman48123e02014-09-02 10:51:56 -070015#pragma pack(push, 1)
16
Alex Elder05ad1892014-09-09 13:55:03 -050017struct greybus_manifest_header {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070018 __le16 size;
Greg Kroah-Hartman3772f162014-09-01 09:51:33 -070019 __u8 version_major;
20 __u8 version_minor;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070021};
22
23enum greybus_descriptor_type {
24 GREYBUS_TYPE_INVALID = 0x0000,
Matt Porterc41a3662014-09-26 20:49:52 -050025 GREYBUS_TYPE_MODULE = 0x0001,
26 GREYBUS_TYPE_FUNCTION = 0x0002,
27 GREYBUS_TYPE_CLASS = 0x0003,
Greg Kroah-Hartman526c5c82014-09-01 16:03:31 -070028 GREYBUS_TYPE_STRING = 0x0004,
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070029 GREYBUS_TYPE_CPORT = 0x0005,
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070030};
31
32struct greybus_descriptor_header {
33 __le16 size;
34 __le16 type; /* enum greybus_descriptor_type */
35};
36
Matt Porter097724c2014-09-26 20:49:50 -050037enum greybus_function_type {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070038 GREYBUS_FUNCTION_CONTROL = 0x00,
39 GREYBUS_FUNCTION_USB = 0x01,
40 GREYBUS_FUNCTION_GPIO = 0x02,
41 GREYBUS_FUNCTION_SPI = 0x03,
42 GREYBUS_FUNCTION_UART = 0x04,
43 GREYBUS_FUNCTION_PWM = 0x05,
44 GREYBUS_FUNCTION_I2S = 0x06,
45 GREYBUS_FUNCTION_I2C = 0x07,
46 GREYBUS_FUNCTION_SDIO = 0x08,
47 GREYBUS_FUNCTION_HID = 0x09,
48 GREYBUS_FUNCTION_DISPLAY = 0x0a,
49 GREYBUS_FUNCTION_CAMERA = 0x0b,
50 GREYBUS_FUNCTION_SENSOR = 0x0c,
51 GREYBUS_FUNCTION_VENDOR = 0xff,
52};
53
54struct greybus_descriptor_function {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070055 __le16 cport;
Matt Porter097724c2014-09-26 20:49:50 -050056 __u8 function_type; /* enum greybus_function_type */
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070057};
58
Matt Porter6d63ff72014-09-26 20:49:48 -050059struct greybus_descriptor_module {
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070060 __le16 vendor;
61 __le16 product;
62 __le16 version;
Matt Porter4fc64542014-09-26 20:49:49 -050063 __le64 serial_number;
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070064 __u8 vendor_stringid;
65 __u8 product_stringid;
66};
67
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070068struct greybus_descriptor_string {
Matt Portercbd0fd72014-09-26 20:49:51 -050069 __u8 length;
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070070 __u8 id;
71 __u8 string[0];
72};
73
74struct greybus_descriptor_cport {
Alex Elder0db32a62014-09-24 05:16:14 -050075 __le16 id;
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070076 __le16 size;
77 __u8 speed; // FIXME
78 __u8 reserved;
79};
80
Greg Kroah-Hartman6dca7b92014-09-01 13:42:43 -070081struct greybus_descriptor {
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070082 struct greybus_descriptor_header header;
83 union {
Greg Kroah-Hartmand5877802014-09-01 10:59:08 -070084 struct greybus_descriptor_function function;
Matt Porter6d63ff72014-09-26 20:49:48 -050085 struct greybus_descriptor_module module;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070086 struct greybus_descriptor_string string;
87 struct greybus_descriptor_cport cport;
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070088 };
89};
90
Alex Elderbadad682014-09-09 13:55:04 -050091struct greybus_manifest {
92 struct greybus_manifest_header header;
93 struct greybus_descriptor descriptors[0];
94};
95
Greg Kroah-Hartman48123e02014-09-02 10:51:56 -070096#pragma pack(pop)
97
Greg Kroah-Hartman80ebe8a2014-08-31 18:08:52 -070098#endif /* __GREYBUS_DESC_H */