blob: 5c12c72ddcec86e99948c29a1a933dfeec8d6115 [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;
Alex Elder63cc9322014-10-02 12:30:02 -050019 u8 id;
Viresh Kumar88e6d372015-04-06 15:49:36 +053020 u8 class;
Matt Porter1a4c0132014-10-21 22:43:30 -040021 u8 device_id;
Alex Elder748e1232014-10-03 14:14:22 -050022 struct list_head connections;
Greg Kroah-Hartman75052a52015-04-13 19:48:37 +020023 u8 *state;
Alex Elder8c12cde2014-10-01 21:54:12 -050024
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050025 struct list_head links; /* interface->bundles */
Alex Elder8c12cde2014-10-01 21:54:12 -050026};
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050027#define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
Alex Elder8c12cde2014-10-01 21:54:12 -050028
Greg Kroah-Hartman1b6ea0d2014-12-24 13:01:39 -080029#define GB_DEVICE_ID_BAD 0xff
30
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050031/* Greybus "private" definitions" */
Viresh Kumar7c183f72015-04-01 20:32:00 +053032struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
Viresh Kumar88e6d372015-04-06 15:49:36 +053033 u8 class);
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -080034void gb_bundle_destroy(struct gb_interface *intf);
Viresh Kumarbb97ea82015-04-01 20:32:01 +053035int gb_bundle_init(struct gb_bundle *bundle, u8 device_id);
36int gb_bundles_init(struct gb_interface *intf, u8 device_id);
Alex Elder8c12cde2014-10-01 21:54:12 -050037
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -080038struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id);
Greg Kroah-Hartmanfb69cb52014-12-23 15:16:53 -080039void gb_bundle_bind_protocols(void);
Matt Porter1a4c0132014-10-21 22:43:30 -040040
Viresh Kumar9f5f30e7122015-04-01 20:32:04 +053041const struct greybus_bundle_id *
42 gb_bundle_match_id(struct gb_bundle *bundle,
43 const struct greybus_bundle_id *id);
44
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050045#endif /* __BUNDLE_H */