1
2
3
4
5
6
7
8
9
10#ifndef __INTERFACE_H
11#define __INTERFACE_H
12
13enum gb_interface_type {
14 GB_INTERFACE_TYPE_INVALID = 0,
15 GB_INTERFACE_TYPE_UNKNOWN,
16 GB_INTERFACE_TYPE_DUMMY,
17 GB_INTERFACE_TYPE_UNIPRO,
18 GB_INTERFACE_TYPE_GREYBUS,
19};
20
21#define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0)
22#define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(1)
23#define GB_INTERFACE_QUIRK_NO_GMP_IDS BIT(2)
24#define GB_INTERFACE_QUIRK_FORCED_DISABLE BIT(3)
25#define GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH BIT(4)
26#define GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE BIT(5)
27#define GB_INTERFACE_QUIRK_NO_PM BIT(6)
28
29struct gb_interface {
30 struct device dev;
31 struct gb_control *control;
32
33 struct list_head bundles;
34 struct list_head module_node;
35 struct list_head manifest_descs;
36 u8 interface_id;
37 u8 device_id;
38 u8 features;
39
40 enum gb_interface_type type;
41
42 u32 ddbl1_manufacturer_id;
43 u32 ddbl1_product_id;
44 u32 vendor_id;
45 u32 product_id;
46 u64 serial_number;
47
48 struct gb_host_device *hd;
49 struct gb_module *module;
50
51 unsigned long quirks;
52
53 struct mutex mutex;
54
55 bool disconnected;
56
57 bool ejected;
58 bool removed;
59 bool active;
60 bool enabled;
61 bool mode_switch;
62 bool dme_read;
63
64 struct work_struct mode_switch_work;
65 struct completion mode_switch_completion;
66};
67#define to_gb_interface(d) container_of(d, struct gb_interface, dev)
68
69struct gb_interface *gb_interface_create(struct gb_module *module,
70 u8 interface_id);
71int gb_interface_activate(struct gb_interface *intf);
72void gb_interface_deactivate(struct gb_interface *intf);
73int gb_interface_enable(struct gb_interface *intf);
74void gb_interface_disable(struct gb_interface *intf);
75int gb_interface_add(struct gb_interface *intf);
76void gb_interface_del(struct gb_interface *intf);
77void gb_interface_put(struct gb_interface *intf);
78void gb_interface_mailbox_event(struct gb_interface *intf, u16 result,
79 u32 mailbox);
80
81int gb_interface_request_mode_switch(struct gb_interface *intf);
82
83#endif
84