blob: 18b125e8169b3b8064248551a4216b13fdd14121 [file] [log] [blame]
Alex Elder8c12cde2014-10-01 21:54:12 -05001/*
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -05002 * Greybus bundles
Alex Elder8c12cde2014-10-01 21:54:12 -05003 *
4 * Copyright 2014 Google Inc.
Alex Eldera46e9672014-12-12 12:08:42 -06005 * Copyright 2014 Linaro Ltd.
Alex Elder8c12cde2014-10-01 21:54:12 -05006 *
7 * Released under the GPLv2 only.
8 */
9
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050010#ifndef __BUNDLE_H
11#define __BUNDLE_H
Alex Elder8c12cde2014-10-01 21:54:12 -050012
13#include <linux/list.h>
14
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050015/* Greybus "public" definitions" */
16struct gb_bundle {
Greg Kroah-Hartmanf0f61b92014-10-24 17:34:46 +080017 struct device dev;
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -080018 struct gb_interface *intf;
Johan Hovoldb807aa72016-01-19 12:51:21 +010019
Alex Elder63cc9322014-10-02 12:30:02 -050020 u8 id;
Viresh Kumar88e6d372015-04-06 15:49:36 +053021 u8 class;
Johan Hovoldb807aa72016-01-19 12:51:21 +010022 u8 class_major;
23 u8 class_minor;
24
Johan Hovold98fdf5a2016-01-21 17:34:09 +010025 size_t num_cports;
26 struct greybus_descriptor_cport *cport_desc;
27
Alex Elder748e1232014-10-03 14:14:22 -050028 struct list_head connections;
Greg Kroah-Hartman75052a52015-04-13 19:48:37 +020029 u8 *state;
Alex Elder8c12cde2014-10-01 21:54:12 -050030
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050031 struct list_head links; /* interface->bundles */
Alex Elder8c12cde2014-10-01 21:54:12 -050032};
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050033#define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
Alex Elder8c12cde2014-10-01 21:54:12 -050034
Greg Kroah-Hartman1b6ea0d2014-12-24 13:01:39 -080035#define GB_DEVICE_ID_BAD 0xff
36
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050037/* Greybus "private" definitions" */
Viresh Kumar7c183f72015-04-01 20:32:00 +053038struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
Viresh Kumar88e6d372015-04-06 15:49:36 +053039 u8 class);
Johan Hovolda7e36d02015-12-07 15:05:43 +010040int gb_bundle_add(struct gb_bundle *bundle);
Alex Elderfe53b452015-06-12 10:21:11 -050041void gb_bundle_destroy(struct gb_bundle *bundle);
Alex Elder8c12cde2014-10-01 21:54:12 -050042
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050043#endif /* __BUNDLE_H */