1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Copyright 2014 Google Inc.
6 * Copyright 2014 Linaro Ltd.
12 #include <linux/list.h>
14 #define BUNDLE_ID_NONE U8_MAX
16 /* Greybus "public" definitions" */
19 struct gb_interface *intf;
27 struct greybus_descriptor_cport *cport_desc;
29 struct list_head connections;
32 struct list_head links; /* interface->bundles */
34 #define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
36 /* Greybus "private" definitions" */
37 struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
39 int gb_bundle_add(struct gb_bundle *bundle);
40 void gb_bundle_destroy(struct gb_bundle *bundle);
42 /* Bundle Runtime PM wrappers */
44 static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
48 retval = pm_runtime_get_sync(&bundle->dev);
51 "pm_runtime_get_sync failed: %d\n", retval);
52 pm_runtime_put_noidle(&bundle->dev);
59 static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
63 pm_runtime_mark_last_busy(&bundle->dev);
64 retval = pm_runtime_put_autosuspend(&bundle->dev);
69 static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle)
71 pm_runtime_get_noresume(&bundle->dev);
74 static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle)
76 pm_runtime_put_noidle(&bundle->dev);
80 static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
82 static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
85 static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle) {}
86 static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle) {}
89 #endif /* __BUNDLE_H */