2014-10-01 22:54:11 -04:00
|
|
|
/*
|
2014-12-11 17:10:56 -05:00
|
|
|
* Greybus Interface Block code
|
2014-10-01 22:54:11 -04:00
|
|
|
*
|
|
|
|
* Copyright 2014 Google Inc.
|
2014-12-12 13:08:42 -05:00
|
|
|
* Copyright 2014 Linaro Ltd.
|
2014-10-01 22:54:11 -04:00
|
|
|
*
|
|
|
|
* Released under the GPLv2 only.
|
|
|
|
*/
|
|
|
|
|
2014-12-19 17:56:30 -05:00
|
|
|
#ifndef __INTERFACE_H
|
|
|
|
#define __INTERFACE_H
|
2014-10-01 22:54:11 -04:00
|
|
|
|
2014-12-11 17:10:56 -05:00
|
|
|
/* Greybus "public" definitions" */
|
2014-12-19 17:56:31 -05:00
|
|
|
struct gb_interface {
|
2014-10-01 22:54:11 -04:00
|
|
|
struct device dev;
|
|
|
|
|
2014-12-19 17:56:29 -05:00
|
|
|
struct list_head bundles;
|
2014-12-19 17:56:36 -05:00
|
|
|
struct list_head links; /* greybus_host_device->interfaces */
|
2014-12-23 18:16:50 -05:00
|
|
|
struct list_head manifest_descs;
|
2014-12-21 17:10:26 -05:00
|
|
|
u8 interface_id; /* Physical location within the Endo */
|
2014-10-01 22:54:11 -04:00
|
|
|
|
2015-04-01 11:02:02 -04:00
|
|
|
/* Information taken from the manifest descriptor */
|
2014-10-01 22:54:16 -04:00
|
|
|
u16 vendor;
|
|
|
|
u16 product;
|
|
|
|
char *vendor_string;
|
|
|
|
char *product_string;
|
2014-10-02 13:30:02 -04:00
|
|
|
u64 unique_id;
|
2014-10-01 22:54:16 -04:00
|
|
|
|
2014-12-21 17:10:26 -05:00
|
|
|
struct gb_module *module;
|
2014-10-01 22:54:11 -04:00
|
|
|
struct greybus_host_device *hd;
|
|
|
|
};
|
2014-12-19 17:56:31 -05:00
|
|
|
#define to_gb_interface(d) container_of(d, struct gb_interface, dev)
|
2014-10-01 22:54:11 -04:00
|
|
|
|
2014-12-19 17:56:31 -05:00
|
|
|
static inline void gb_interface_set_drvdata(struct gb_interface *intf,
|
|
|
|
void *data)
|
2014-10-01 22:54:11 -04:00
|
|
|
{
|
2014-12-19 17:56:31 -05:00
|
|
|
dev_set_drvdata(&intf->dev, data);
|
2014-10-01 22:54:11 -04:00
|
|
|
}
|
|
|
|
|
2015-03-19 07:32:48 -04:00
|
|
|
static inline void *gb_interface_get_drvdata(struct gb_interface *intf)
|
2014-10-01 22:54:11 -04:00
|
|
|
{
|
2014-12-19 17:56:31 -05:00
|
|
|
return dev_get_drvdata(&intf->dev);
|
2014-10-01 22:54:11 -04:00
|
|
|
}
|
|
|
|
|
2014-12-11 17:10:56 -05:00
|
|
|
/* Greybus "private" definitions */
|
2014-10-01 22:54:11 -04:00
|
|
|
|
2014-12-19 17:56:31 -05:00
|
|
|
struct gb_interface *gb_interface_find(struct greybus_host_device *hd,
|
2015-04-01 11:01:58 -04:00
|
|
|
u8 interface_id);
|
2014-10-21 22:43:29 -04:00
|
|
|
|
2015-04-01 11:01:58 -04:00
|
|
|
void gb_add_interface(struct greybus_host_device *hd, u8 interface_id, u8 *data,
|
|
|
|
int size);
|
|
|
|
void gb_remove_interface(struct greybus_host_device *hd, u8 interface_id);
|
2014-12-19 17:56:35 -05:00
|
|
|
void gb_remove_interfaces(struct greybus_host_device *hd);
|
|
|
|
|
|
|
|
|
2014-12-19 17:56:30 -05:00
|
|
|
#endif /* __INTERFACE_H */
|