2019-08-25 05:54:21 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2014-09-01 01:08:52 +00:00
|
|
|
/*
|
2015-04-01 15:02:02 +00:00
|
|
|
* Greybus manifest definition
|
2014-09-01 01:08:52 +00:00
|
|
|
*
|
2014-09-24 10:16:17 +00:00
|
|
|
* See "Greybus Application Protocol" document (version 0.1) for
|
2014-09-24 10:16:16 +00:00
|
|
|
* details on these values and structures.
|
2014-09-01 01:08:52 +00:00
|
|
|
*
|
2015-05-22 17:59:16 +00:00
|
|
|
* Copyright 2014-2015 Google Inc.
|
|
|
|
* Copyright 2014-2015 Linaro Ltd.
|
2014-09-24 10:16:16 +00:00
|
|
|
*
|
2014-10-07 03:37:53 +00:00
|
|
|
* Released under the GPLv2 and BSD licenses.
|
2014-09-01 01:08:52 +00:00
|
|
|
*/
|
|
|
|
|
2014-09-27 01:55:32 +00:00
|
|
|
#ifndef __GREYBUS_MANIFEST_H
|
|
|
|
#define __GREYBUS_MANIFEST_H
|
2014-09-01 01:08:52 +00:00
|
|
|
|
staging: greybus: add missing includes
Before moving greybus core out of staging and moving header files to
include/linux some greybus header files were missing the necessary
includes. This would trigger compilation faillures with some example
errors logged bellow for with CONFIG_KERNEL_HEADER_TEST=y.
So, add the necessary headers to compile clean before relocating the
header files.
./include/linux/greybus/hd.h:23:50: error: unknown type name 'u16'
int (*cport_disable)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/greybus_protocols.h:1314:2: error: unknown type name '__u8'
__u8 data[0];
^~~~
./include/linux/greybus/hd.h:24:52: error: unknown type name 'u16'
int (*cport_connected)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:25:48: error: unknown type name 'u16'
int (*cport_flush)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:26:51: error: unknown type name 'u16'
int (*cport_shutdown)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:27:5: error: unknown type name 'u8'
u8 phase, unsigned int timeout);
^~
./include/linux/greybus/hd.h:28:50: error: unknown type name 'u16'
int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:29:5: error: unknown type name 'size_t'
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:29:5: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
./include/linux/greybus/hd.h:1:1:
+#include <stddef.h>
/* SPDX-License-Identifier: GPL-2.0 */
./include/linux/greybus/hd.h:29:5:
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:30:48: error: unknown type name 'u16'
int (*cport_clear)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:32:49: error: unknown type name 'u16'
int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id, ^~~
./include/linux/greybus/hd.h:33:32: error: unknown type name 'gfp_t'
struct gb_message *message, gfp_t gfp_mask); ^~~~~
./include/linux/greybus/hd.h:35:55: error: unknown type name 'u16'
int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Gao Xiang <hsiangkao@aol.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20190827155302.25704-1-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-27 15:53:02 +00:00
|
|
|
#include <linux/bits.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
2014-09-01 01:08:52 +00:00
|
|
|
enum greybus_descriptor_type {
|
2014-09-27 01:55:33 +00:00
|
|
|
GREYBUS_TYPE_INVALID = 0x00,
|
2015-04-01 15:01:59 +00:00
|
|
|
GREYBUS_TYPE_INTERFACE = 0x01,
|
2014-10-02 17:30:02 +00:00
|
|
|
GREYBUS_TYPE_STRING = 0x02,
|
2015-04-01 15:01:59 +00:00
|
|
|
GREYBUS_TYPE_BUNDLE = 0x03,
|
2014-10-02 17:30:02 +00:00
|
|
|
GREYBUS_TYPE_CPORT = 0x04,
|
2014-09-01 01:08:52 +00:00
|
|
|
};
|
|
|
|
|
2014-10-02 17:30:02 +00:00
|
|
|
enum greybus_protocol {
|
|
|
|
GREYBUS_PROTOCOL_CONTROL = 0x00,
|
2016-03-08 15:50:43 +00:00
|
|
|
/* 0x01 is unused */
|
2014-10-02 17:30:02 +00:00
|
|
|
GREYBUS_PROTOCOL_GPIO = 0x02,
|
|
|
|
GREYBUS_PROTOCOL_I2C = 0x03,
|
|
|
|
GREYBUS_PROTOCOL_UART = 0x04,
|
|
|
|
GREYBUS_PROTOCOL_HID = 0x05,
|
2014-11-17 23:19:14 +00:00
|
|
|
GREYBUS_PROTOCOL_USB = 0x06,
|
|
|
|
GREYBUS_PROTOCOL_SDIO = 0x07,
|
2015-11-12 15:36:00 +00:00
|
|
|
GREYBUS_PROTOCOL_POWER_SUPPLY = 0x08,
|
2014-11-13 14:14:13 +00:00
|
|
|
GREYBUS_PROTOCOL_PWM = 0x09,
|
2015-11-04 16:47:22 +00:00
|
|
|
/* 0x0a is unused */
|
2014-11-17 23:19:14 +00:00
|
|
|
GREYBUS_PROTOCOL_SPI = 0x0b,
|
|
|
|
GREYBUS_PROTOCOL_DISPLAY = 0x0c,
|
2015-12-15 01:18:05 +00:00
|
|
|
GREYBUS_PROTOCOL_CAMERA_MGMT = 0x0d,
|
2014-11-17 23:19:14 +00:00
|
|
|
GREYBUS_PROTOCOL_SENSOR = 0x0e,
|
2015-05-11 18:22:03 +00:00
|
|
|
GREYBUS_PROTOCOL_LIGHTS = 0x0f,
|
2014-11-17 23:19:14 +00:00
|
|
|
GREYBUS_PROTOCOL_VIBRATOR = 0x10,
|
2015-03-31 07:51:59 +00:00
|
|
|
GREYBUS_PROTOCOL_LOOPBACK = 0x11,
|
2015-11-13 21:44:13 +00:00
|
|
|
GREYBUS_PROTOCOL_AUDIO_MGMT = 0x12,
|
|
|
|
GREYBUS_PROTOCOL_AUDIO_DATA = 0x13,
|
2015-05-22 18:02:08 +00:00
|
|
|
GREYBUS_PROTOCOL_SVC = 0x14,
|
2016-04-03 06:48:35 +00:00
|
|
|
GREYBUS_PROTOCOL_BOOTROM = 0x15,
|
2015-12-15 01:18:05 +00:00
|
|
|
GREYBUS_PROTOCOL_CAMERA_DATA = 0x16,
|
2016-04-26 04:50:49 +00:00
|
|
|
GREYBUS_PROTOCOL_FW_DOWNLOAD = 0x17,
|
|
|
|
GREYBUS_PROTOCOL_FW_MANAGEMENT = 0x18,
|
2016-06-30 15:54:00 +00:00
|
|
|
GREYBUS_PROTOCOL_AUTHENTICATION = 0x19,
|
2016-06-24 21:41:36 +00:00
|
|
|
GREYBUS_PROTOCOL_LOG = 0x1a,
|
2014-10-02 17:30:02 +00:00
|
|
|
/* ... */
|
2015-05-08 13:50:17 +00:00
|
|
|
GREYBUS_PROTOCOL_RAW = 0xfe,
|
2014-10-02 17:30:02 +00:00
|
|
|
GREYBUS_PROTOCOL_VENDOR = 0xff,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum greybus_class_type {
|
2014-10-03 19:14:23 +00:00
|
|
|
GREYBUS_CLASS_CONTROL = 0x00,
|
2016-03-08 15:50:43 +00:00
|
|
|
/* 0x01 is unused */
|
2016-05-10 03:20:13 +00:00
|
|
|
/* 0x02 is unused */
|
|
|
|
/* 0x03 is unused */
|
|
|
|
/* 0x04 is unused */
|
2014-10-20 05:27:42 +00:00
|
|
|
GREYBUS_CLASS_HID = 0x05,
|
2016-05-10 03:20:13 +00:00
|
|
|
/* 0x06 is unused */
|
|
|
|
/* 0x07 is unused */
|
2015-11-12 15:36:00 +00:00
|
|
|
GREYBUS_CLASS_POWER_SUPPLY = 0x08,
|
2016-05-10 03:20:13 +00:00
|
|
|
/* 0x09 is unused */
|
2016-02-28 22:13:27 +00:00
|
|
|
GREYBUS_CLASS_BRIDGED_PHY = 0x0a,
|
2016-05-10 03:20:13 +00:00
|
|
|
/* 0x0b is unused */
|
2014-10-20 05:27:42 +00:00
|
|
|
GREYBUS_CLASS_DISPLAY = 0x0c,
|
|
|
|
GREYBUS_CLASS_CAMERA = 0x0d,
|
|
|
|
GREYBUS_CLASS_SENSOR = 0x0e,
|
2015-06-30 06:10:18 +00:00
|
|
|
GREYBUS_CLASS_LIGHTS = 0x0f,
|
|
|
|
GREYBUS_CLASS_VIBRATOR = 0x10,
|
|
|
|
GREYBUS_CLASS_LOOPBACK = 0x11,
|
2016-01-27 05:47:00 +00:00
|
|
|
GREYBUS_CLASS_AUDIO = 0x12,
|
|
|
|
/* 0x13 is unused */
|
2016-03-09 15:13:55 +00:00
|
|
|
/* 0x14 is unused */
|
2016-04-03 06:48:35 +00:00
|
|
|
GREYBUS_CLASS_BOOTROM = 0x15,
|
2016-04-26 04:50:49 +00:00
|
|
|
GREYBUS_CLASS_FW_MANAGEMENT = 0x16,
|
2016-06-24 21:41:36 +00:00
|
|
|
GREYBUS_CLASS_LOG = 0x17,
|
2015-07-21 12:14:10 +00:00
|
|
|
/* ... */
|
|
|
|
GREYBUS_CLASS_RAW = 0xfe,
|
2014-10-03 19:14:23 +00:00
|
|
|
GREYBUS_CLASS_VENDOR = 0xff,
|
2014-09-01 01:08:52 +00:00
|
|
|
};
|
|
|
|
|
2016-05-15 18:37:49 +00:00
|
|
|
enum {
|
|
|
|
GREYBUS_INTERFACE_FEATURE_TIMESYNC = BIT(0),
|
|
|
|
};
|
|
|
|
|
2014-10-02 17:30:02 +00:00
|
|
|
/*
|
|
|
|
* The string in a string descriptor is not NUL-terminated. The
|
|
|
|
* size of the descriptor will be rounded up to a multiple of 4
|
|
|
|
* bytes, by padding the string with 0x00 bytes if necessary.
|
|
|
|
*/
|
|
|
|
struct greybus_descriptor_string {
|
|
|
|
__u8 length;
|
|
|
|
__u8 id;
|
2022-02-15 01:11:44 +00:00
|
|
|
__u8 string[];
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-09-01 17:59:08 +00:00
|
|
|
|
2014-10-02 02:54:10 +00:00
|
|
|
/*
|
2015-04-01 15:02:02 +00:00
|
|
|
* An interface descriptor describes information about an interface as a whole,
|
|
|
|
* *not* the functions within it.
|
2014-10-02 02:54:10 +00:00
|
|
|
*/
|
|
|
|
struct greybus_descriptor_interface {
|
2015-04-01 15:02:02 +00:00
|
|
|
__u8 vendor_stringid;
|
|
|
|
__u8 product_stringid;
|
2016-05-15 18:37:49 +00:00
|
|
|
__u8 features;
|
|
|
|
__u8 pad;
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-10-02 02:54:10 +00:00
|
|
|
|
2015-04-01 15:01:59 +00:00
|
|
|
/*
|
2015-04-06 10:19:36 +00:00
|
|
|
* An bundle descriptor defines an identification number and a class for
|
2015-04-01 15:01:59 +00:00
|
|
|
* each bundle.
|
|
|
|
*
|
|
|
|
* @id: Uniquely identifies a bundle within a interface, its sole purpose is to
|
|
|
|
* allow CPort descriptors to specify which bundle they are associated with.
|
|
|
|
* The first bundle will have id 0, second will have 1 and so on.
|
|
|
|
*
|
|
|
|
* The largest CPort id associated with an bundle (defined by a
|
|
|
|
* CPort descriptor in the manifest) is used to determine how to
|
|
|
|
* encode the device id and module number in UniPro packets
|
|
|
|
* that use the bundle.
|
|
|
|
*
|
2015-04-06 10:19:36 +00:00
|
|
|
* @class: It is used by kernel to know the functionality provided by the
|
2015-04-01 15:01:59 +00:00
|
|
|
* bundle and will be matched against drivers functinality while probing greybus
|
|
|
|
* driver. It should contain one of the values defined in
|
|
|
|
* 'enum greybus_class_type'.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct greybus_descriptor_bundle {
|
|
|
|
__u8 id; /* interface-relative id (0..) */
|
2015-04-06 10:19:36 +00:00
|
|
|
__u8 class;
|
2015-04-28 14:21:40 +00:00
|
|
|
__u8 pad[2];
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2015-04-01 15:01:59 +00:00
|
|
|
|
2014-10-02 17:30:02 +00:00
|
|
|
/*
|
2014-12-12 22:10:17 +00:00
|
|
|
* A CPort descriptor indicates the id of the bundle within the
|
2014-10-02 17:30:02 +00:00
|
|
|
* module it's associated with, along with the CPort id used to
|
2014-10-29 00:35:59 +00:00
|
|
|
* address the CPort. The protocol id defines the format of messages
|
2014-10-02 17:30:02 +00:00
|
|
|
* exchanged using the CPort.
|
|
|
|
*/
|
2014-10-02 02:54:10 +00:00
|
|
|
struct greybus_descriptor_cport {
|
|
|
|
__le16 id;
|
2015-04-28 14:21:41 +00:00
|
|
|
__u8 bundle;
|
2014-10-29 00:35:59 +00:00
|
|
|
__u8 protocol_id; /* enum greybus_protocol */
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-10-02 02:54:10 +00:00
|
|
|
|
|
|
|
struct greybus_descriptor_header {
|
|
|
|
__le16 size;
|
2014-10-02 17:30:02 +00:00
|
|
|
__u8 type; /* enum greybus_descriptor_type */
|
2015-04-28 14:21:40 +00:00
|
|
|
__u8 pad;
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-09-01 17:59:08 +00:00
|
|
|
|
2014-09-01 20:42:43 +00:00
|
|
|
struct greybus_descriptor {
|
2014-10-02 17:30:02 +00:00
|
|
|
struct greybus_descriptor_header header;
|
2014-09-01 01:08:52 +00:00
|
|
|
union {
|
|
|
|
struct greybus_descriptor_string string;
|
2014-10-02 02:54:10 +00:00
|
|
|
struct greybus_descriptor_interface interface;
|
2015-04-01 15:01:59 +00:00
|
|
|
struct greybus_descriptor_bundle bundle;
|
2014-09-01 01:08:52 +00:00
|
|
|
struct greybus_descriptor_cport cport;
|
|
|
|
};
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-09-01 01:08:52 +00:00
|
|
|
|
2014-10-02 02:54:10 +00:00
|
|
|
struct greybus_manifest_header {
|
|
|
|
__le16 size;
|
|
|
|
__u8 version_major;
|
|
|
|
__u8 version_minor;
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-10-02 02:54:10 +00:00
|
|
|
|
2014-09-09 18:55:04 +00:00
|
|
|
struct greybus_manifest {
|
|
|
|
struct greybus_manifest_header header;
|
2022-02-15 01:11:44 +00:00
|
|
|
struct greybus_descriptor descriptors[];
|
2015-04-28 14:21:34 +00:00
|
|
|
} __packed;
|
2014-09-02 17:51:56 +00:00
|
|
|
|
2014-09-27 01:55:32 +00:00
|
|
|
#endif /* __GREYBUS_MANIFEST_H */
|