4 * Copyright 2014 Google Inc.
5 * Copyright 2014 Linaro Ltd.
7 * Released under the GPLv2 only.
10 #ifndef __CONNECTION_H
11 #define __CONNECTION_H
13 #include <linux/list.h>
15 enum gb_connection_state {
16 GB_CONNECTION_STATE_INVALID = 0,
17 GB_CONNECTION_STATE_DISABLED = 1,
18 GB_CONNECTION_STATE_ENABLED = 2,
19 GB_CONNECTION_STATE_ERROR = 3,
20 GB_CONNECTION_STATE_DESTROYING = 4,
23 struct gb_connection {
24 struct greybus_host_device *hd;
25 struct gb_bundle *bundle;
30 struct list_head hd_links;
31 struct list_head bundle_links;
33 struct gb_protocol *protocol;
38 enum gb_connection_state state;
41 struct list_head operations;
45 #define to_gb_connection(d) container_of(d, struct gb_connection, dev)
47 struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
48 u16 cport_id, u8 protocol_id);
49 void gb_connection_destroy(struct gb_connection *connection);
51 int gb_connection_init(struct gb_connection *connection);
52 void gb_connection_exit(struct gb_connection *connection);
54 struct gb_connection *gb_connection_hd_find(struct greybus_host_device *hd,
57 void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
58 u8 *data, size_t length);
60 void gb_connection_bind_protocol(struct gb_connection *connection);
62 #endif /* __CONNECTION_H */