android_kernel_xiaomi_sm8350/drivers/staging/greybus/interface.h

66 lines
1.7 KiB
C
Raw Normal View History

/*
* Greybus Interface Block code
*
* Copyright 2014 Google Inc.
* Copyright 2014 Linaro Ltd.
*
* Released under the GPLv2 only.
*/
#ifndef __INTERFACE_H
#define __INTERFACE_H
/* Greybus "public" definitions" */
struct gb_interface {
struct device dev;
struct gb_control *control;
struct list_head bundles;
struct list_head links; /* gb_host_device->interfaces */
struct list_head manifest_descs;
greybus: add module support Modules in the greybus system sit above the interface, so insert them early in the sysfs tree. We dynamically create them when we have an interface that references a module, as we don't get a "module create" message directly. They also dynamically go away when the last interface associated with a module is removed. Naming scheme for modules/interfaces/bundles/connections is bumped up by one ':', and now looks like the following: /sys/bus/greybus $ tree . ├── devices │   ├── 7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7 │   ├── 7:7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7 │   ├── 7:7:0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7/7:7:0 │   └── 7:7:0:1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7/7:7:0/7:7:0:1 ├── drivers ├── drivers_autoprobe ├── drivers_probe └── uevent 6 directories, 3 files /sys/bus/greybus $ grep . devices/*/uevent devices/7/uevent:DEVTYPE=greybus_module devices/7:7/uevent:DEVTYPE=greybus_interface devices/7:7:0/uevent:DEVTYPE=greybus_bundle devices/7:7:0:1/uevent:DEVTYPE=greybus_connection We still have some "confusion" about interface ids and module ids, which will be cleaned up later when the svc control protocol changes die down, right now we just name a module after the interface as we don't have any modules that have multiple interfaces in our systems. This has been tested with gbsim. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-12-21 17:10:26 -05:00
u8 interface_id; /* Physical location within the Endo */
u8 device_id; /* Device id allocated for the interface block by the SVC */
/* Information taken from the manifest descriptor */
char *vendor_string;
char *product_string;
/* Information taken from the hotplug event */
u32 ddbl1_manufacturer_id;
u32 ddbl1_product_id;
u32 vendor_id;
u32 product_id;
struct gb_host_device *hd;
/* The interface needs to boot over unipro */
bool boot_over_unipro;
bool disconnected;
};
#define to_gb_interface(d) container_of(d, struct gb_interface, dev)
static inline void gb_interface_set_drvdata(struct gb_interface *intf,
void *data)
{
dev_set_drvdata(&intf->dev, data);
}
static inline void *gb_interface_get_drvdata(struct gb_interface *intf)
{
return dev_get_drvdata(&intf->dev);
}
/* Greybus "private" definitions */
struct gb_interface *gb_interface_find(struct gb_host_device *hd,
u8 interface_id);
struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id);
void gb_interface_destroy(struct gb_interface *intf);
int gb_interface_init(struct gb_interface *intf, u8 device_id);
void gb_interface_remove(struct gb_interface *intf);
void gb_interfaces_remove(struct gb_host_device *hd);
#endif /* __INTERFACE_H */