greybus: interface: Extract and store Interface feature byte
[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
17 struct gb_interface {
18         struct device dev;
19         struct gb_control *control;
20
21         struct list_head bundles;
22         struct list_head module_node;
23         struct list_head manifest_descs;
24         u8 interface_id;        /* Physical location within the Endo */
25         u8 device_id;
26         u8 features;            /* Feature flags set in the manifest */
27
28         u32 ddbl1_manufacturer_id;
29         u32 ddbl1_product_id;
30         u32 vendor_id;
31         u32 product_id;
32         u64 serial_number;
33
34         struct gb_host_device *hd;
35         struct gb_module *module;
36
37         unsigned long quirks;
38
39         struct mutex mutex;
40
41         bool disconnected;
42         bool ejected;
43         bool active;
44         bool enabled;
45 };
46 #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
47
48 struct gb_interface *gb_interface_create(struct gb_module *module,
49                                          u8 interface_id);
50 int gb_interface_activate(struct gb_interface *intf);
51 void gb_interface_deactivate(struct gb_interface *intf);
52 int gb_interface_enable(struct gb_interface *intf);
53 void gb_interface_disable(struct gb_interface *intf);
54 int gb_interface_add(struct gb_interface *intf);
55 void gb_interface_del(struct gb_interface *intf);
56 void gb_interface_put(struct gb_interface *intf);
57
58 #endif /* __INTERFACE_H */