e833f7df025de07a13bf76fe420212b0920a67d0
[cascardo/linux.git] / drivers / staging / greybus / interface.h
1 /*
2  * Greybus Interface Block code
3  *
4  * Copyright 2014 Google Inc.
5  * Copyright 2014 Linaro Ltd.
6  *
7  * Released under the GPLv2 only.
8  */
9
10 #ifndef __INTERFACE_H
11 #define __INTERFACE_H
12
13 #define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES            BIT(0)
14 #define GB_INTERFACE_QUIRK_NO_INIT_STATUS               BIT(1)
15 #define GB_INTERFACE_QUIRK_NO_ARA_IDS                   BIT(2)
16 #define GB_INTERFACE_QUIRK_FORCED_DISABLE               BIT(3)
17
18 struct gb_interface {
19         struct device dev;
20         struct gb_control *control;
21
22         struct list_head bundles;
23         struct list_head module_node;
24         struct list_head manifest_descs;
25         u8 interface_id;        /* Physical location within the Endo */
26         u8 device_id;
27         u8 features;            /* Feature flags set in the manifest */
28
29         u32 ddbl1_manufacturer_id;
30         u32 ddbl1_product_id;
31         u32 vendor_id;
32         u32 product_id;
33         u64 serial_number;
34
35         struct gb_host_device *hd;
36         struct gb_module *module;
37
38         unsigned long quirks;
39
40         struct mutex mutex;
41
42         bool disconnected;
43         bool ejected;
44         bool active;
45         bool enabled;
46 };
47 #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
48
49 struct gb_interface *gb_interface_create(struct gb_module *module,
50                                          u8 interface_id);
51 int gb_interface_activate(struct gb_interface *intf);
52 void gb_interface_deactivate(struct gb_interface *intf);
53 int gb_interface_enable(struct gb_interface *intf);
54 void gb_interface_disable(struct gb_interface *intf);
55 int gb_interface_add(struct gb_interface *intf);
56 void gb_interface_del(struct gb_interface *intf);
57 void gb_interface_put(struct gb_interface *intf);
58
59 #endif /* __INTERFACE_H */