2018-11-09 21:54:00 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2014-10-02 10:54:12 +08:00
|
|
|
/*
|
2014-12-13 06:10:17 +08:00
|
|
|
* Greybus bundles
|
2014-10-02 10:54:12 +08:00
|
|
|
*
|
|
|
|
* Copyright 2014 Google Inc.
|
2014-12-13 02:08:42 +08:00
|
|
|
* Copyright 2014 Linaro Ltd.
|
2014-10-02 10:54:12 +08:00
|
|
|
*/
|
|
|
|
|
2014-12-13 06:10:17 +08:00
|
|
|
#ifndef __BUNDLE_H
|
|
|
|
#define __BUNDLE_H
|
2014-10-02 10:54:12 +08:00
|
|
|
|
staging: greybus: add missing includes
Before moving greybus core out of staging and moving header files to
include/linux some greybus header files were missing the necessary
includes. This would trigger compilation faillures with some example
errors logged bellow for with CONFIG_KERNEL_HEADER_TEST=y.
So, add the necessary headers to compile clean before relocating the
header files.
./include/linux/greybus/hd.h:23:50: error: unknown type name 'u16'
int (*cport_disable)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/greybus_protocols.h:1314:2: error: unknown type name '__u8'
__u8 data[0];
^~~~
./include/linux/greybus/hd.h:24:52: error: unknown type name 'u16'
int (*cport_connected)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:25:48: error: unknown type name 'u16'
int (*cport_flush)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:26:51: error: unknown type name 'u16'
int (*cport_shutdown)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:27:5: error: unknown type name 'u8'
u8 phase, unsigned int timeout);
^~
./include/linux/greybus/hd.h:28:50: error: unknown type name 'u16'
int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:29:5: error: unknown type name 'size_t'
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:29:5: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
./include/linux/greybus/hd.h:1:1:
+#include <stddef.h>
/* SPDX-License-Identifier: GPL-2.0 */
./include/linux/greybus/hd.h:29:5:
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:30:48: error: unknown type name 'u16'
int (*cport_clear)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:32:49: error: unknown type name 'u16'
int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id, ^~~
./include/linux/greybus/hd.h:33:32: error: unknown type name 'gfp_t'
struct gb_message *message, gfp_t gfp_mask); ^~~~~
./include/linux/greybus/hd.h:35:55: error: unknown type name 'u16'
int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Gao Xiang <hsiangkao@aol.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20190827155302.25704-1-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-27 23:53:02 +08:00
|
|
|
#include <linux/types.h>
|
2014-10-02 10:54:12 +08:00
|
|
|
#include <linux/list.h>
|
staging: greybus: add missing includes
Before moving greybus core out of staging and moving header files to
include/linux some greybus header files were missing the necessary
includes. This would trigger compilation faillures with some example
errors logged bellow for with CONFIG_KERNEL_HEADER_TEST=y.
So, add the necessary headers to compile clean before relocating the
header files.
./include/linux/greybus/hd.h:23:50: error: unknown type name 'u16'
int (*cport_disable)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/greybus_protocols.h:1314:2: error: unknown type name '__u8'
__u8 data[0];
^~~~
./include/linux/greybus/hd.h:24:52: error: unknown type name 'u16'
int (*cport_connected)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:25:48: error: unknown type name 'u16'
int (*cport_flush)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:26:51: error: unknown type name 'u16'
int (*cport_shutdown)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:27:5: error: unknown type name 'u8'
u8 phase, unsigned int timeout);
^~
./include/linux/greybus/hd.h:28:50: error: unknown type name 'u16'
int (*cport_quiesce)(struct gb_host_device *hd, u16 cport_id, ^~~
./include/linux/greybus/hd.h:29:5: error: unknown type name 'size_t'
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:29:5: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
./include/linux/greybus/hd.h:1:1:
+#include <stddef.h>
/* SPDX-License-Identifier: GPL-2.0 */
./include/linux/greybus/hd.h:29:5:
size_t peer_space, unsigned int timeout);
^~~~~~
./include/linux/greybus/hd.h:30:48: error: unknown type name 'u16'
int (*cport_clear)(struct gb_host_device *hd, u16 cport_id); ^~~
./include/linux/greybus/hd.h:32:49: error: unknown type name 'u16'
int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id, ^~~
./include/linux/greybus/hd.h:33:32: error: unknown type name 'gfp_t'
struct gb_message *message, gfp_t gfp_mask); ^~~~~
./include/linux/greybus/hd.h:35:55: error: unknown type name 'u16'
int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Gao Xiang <hsiangkao@aol.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20190827155302.25704-1-rui.silva@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-27 23:53:02 +08:00
|
|
|
#include <linux/pm_runtime.h>
|
|
|
|
#include <linux/device.h>
|
2014-10-02 10:54:12 +08:00
|
|
|
|
2016-06-04 04:55:30 +08:00
|
|
|
#define BUNDLE_ID_NONE U8_MAX
|
|
|
|
|
2014-12-13 06:10:17 +08:00
|
|
|
/* Greybus "public" definitions" */
|
|
|
|
struct gb_bundle {
|
2014-10-24 17:34:46 +08:00
|
|
|
struct device dev;
|
2014-12-20 06:56:31 +08:00
|
|
|
struct gb_interface *intf;
|
2016-01-19 19:51:21 +08:00
|
|
|
|
2014-10-03 01:30:02 +08:00
|
|
|
u8 id;
|
2015-04-06 18:19:36 +08:00
|
|
|
u8 class;
|
2016-01-19 19:51:21 +08:00
|
|
|
u8 class_major;
|
|
|
|
u8 class_minor;
|
|
|
|
|
2016-01-22 00:34:09 +08:00
|
|
|
size_t num_cports;
|
|
|
|
struct greybus_descriptor_cport *cport_desc;
|
|
|
|
|
2014-10-04 03:14:22 +08:00
|
|
|
struct list_head connections;
|
2015-04-14 01:48:37 +08:00
|
|
|
u8 *state;
|
2014-10-02 10:54:12 +08:00
|
|
|
|
2014-12-13 06:10:17 +08:00
|
|
|
struct list_head links; /* interface->bundles */
|
2014-10-02 10:54:12 +08:00
|
|
|
};
|
2014-12-13 06:10:17 +08:00
|
|
|
#define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
|
2014-10-02 10:54:12 +08:00
|
|
|
|
2014-12-13 06:10:17 +08:00
|
|
|
/* Greybus "private" definitions" */
|
2015-04-01 23:02:00 +08:00
|
|
|
struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
|
2015-04-06 18:19:36 +08:00
|
|
|
u8 class);
|
2015-12-07 22:05:43 +08:00
|
|
|
int gb_bundle_add(struct gb_bundle *bundle);
|
2015-06-12 23:21:11 +08:00
|
|
|
void gb_bundle_destroy(struct gb_bundle *bundle);
|
2014-10-02 10:54:12 +08:00
|
|
|
|
2016-07-15 04:13:00 +08:00
|
|
|
/* Bundle Runtime PM wrappers */
|
2016-09-09 15:47:01 +08:00
|
|
|
#ifdef CONFIG_PM
|
2016-07-15 04:13:00 +08:00
|
|
|
static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
retval = pm_runtime_get_sync(&bundle->dev);
|
|
|
|
if (retval < 0) {
|
|
|
|
dev_err(&bundle->dev,
|
|
|
|
"pm_runtime_get_sync failed: %d\n", retval);
|
|
|
|
pm_runtime_put_noidle(&bundle->dev);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
pm_runtime_mark_last_busy(&bundle->dev);
|
|
|
|
retval = pm_runtime_put_autosuspend(&bundle->dev);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle)
|
|
|
|
{
|
|
|
|
pm_runtime_get_noresume(&bundle->dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle)
|
|
|
|
{
|
|
|
|
pm_runtime_put_noidle(&bundle->dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
|
|
|
|
{ return 0; }
|
|
|
|
static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
|
|
|
|
{ return 0; }
|
|
|
|
|
|
|
|
static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle) {}
|
|
|
|
static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle) {}
|
|
|
|
#endif
|
|
|
|
|
2014-12-13 06:10:17 +08:00
|
|
|
#endif /* __BUNDLE_H */
|