blob: 385c90a5e9f8f3ca118b981fddaa820b8227e7a0 [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 Kumar7c183f72015-04-01 20:32:00 +053020 u8 class_type;
Matt Porter1a4c0132014-10-21 22:43:30 -040021 u8 device_id;
Alex Elder748e1232014-10-03 14:14:22 -050022 struct list_head connections;
Alex Elder8c12cde2014-10-01 21:54:12 -050023
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050024 struct list_head links; /* interface->bundles */
Alex Elder8c12cde2014-10-01 21:54:12 -050025};
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050026#define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
Alex Elder8c12cde2014-10-01 21:54:12 -050027
Greg Kroah-Hartman1b6ea0d2014-12-24 13:01:39 -080028#define GB_DEVICE_ID_BAD 0xff
29
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050030/* Greybus "private" definitions" */
Viresh Kumar7c183f72015-04-01 20:32:00 +053031struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
32 u8 class_type);
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -080033void gb_bundle_destroy(struct gb_interface *intf);
34int gb_bundle_init(struct gb_interface *intf, u8 module_id, u8 device_id);
Alex Elder8c12cde2014-10-01 21:54:12 -050035
Greg Kroah-Hartman4ab9b3c2014-12-19 14:56:31 -080036struct gb_bundle *gb_bundle_find(struct gb_interface *intf, u8 bundle_id);
Greg Kroah-Hartmanfb69cb52014-12-23 15:16:53 -080037void gb_bundle_bind_protocols(void);
Matt Porter1a4c0132014-10-21 22:43:30 -040038
Greg Kroah-Hartman1db0a5f2014-12-12 17:10:17 -050039#endif /* __BUNDLE_H */