0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __INTERFACE_H
0010 #define __INTERFACE_H
0011
0012 #include <linux/types.h>
0013 #include <linux/device.h>
0014
0015 enum gb_interface_type {
0016 GB_INTERFACE_TYPE_INVALID = 0,
0017 GB_INTERFACE_TYPE_UNKNOWN,
0018 GB_INTERFACE_TYPE_DUMMY,
0019 GB_INTERFACE_TYPE_UNIPRO,
0020 GB_INTERFACE_TYPE_GREYBUS,
0021 };
0022
0023 #define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0)
0024 #define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(1)
0025 #define GB_INTERFACE_QUIRK_NO_GMP_IDS BIT(2)
0026 #define GB_INTERFACE_QUIRK_FORCED_DISABLE BIT(3)
0027 #define GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH BIT(4)
0028 #define GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE BIT(5)
0029 #define GB_INTERFACE_QUIRK_NO_PM BIT(6)
0030
0031 struct gb_interface {
0032 struct device dev;
0033 struct gb_control *control;
0034
0035 struct list_head bundles;
0036 struct list_head module_node;
0037 struct list_head manifest_descs;
0038 u8 interface_id;
0039 u8 device_id;
0040 u8 features;
0041
0042 enum gb_interface_type type;
0043
0044 u32 ddbl1_manufacturer_id;
0045 u32 ddbl1_product_id;
0046 u32 vendor_id;
0047 u32 product_id;
0048 u64 serial_number;
0049
0050 struct gb_host_device *hd;
0051 struct gb_module *module;
0052
0053 unsigned long quirks;
0054
0055 struct mutex mutex;
0056
0057 bool disconnected;
0058
0059 bool ejected;
0060 bool removed;
0061 bool active;
0062 bool enabled;
0063 bool mode_switch;
0064 bool dme_read;
0065
0066 struct work_struct mode_switch_work;
0067 struct completion mode_switch_completion;
0068 };
0069 #define to_gb_interface(d) container_of(d, struct gb_interface, dev)
0070
0071 struct gb_interface *gb_interface_create(struct gb_module *module,
0072 u8 interface_id);
0073 int gb_interface_activate(struct gb_interface *intf);
0074 void gb_interface_deactivate(struct gb_interface *intf);
0075 int gb_interface_enable(struct gb_interface *intf);
0076 void gb_interface_disable(struct gb_interface *intf);
0077 int gb_interface_add(struct gb_interface *intf);
0078 void gb_interface_del(struct gb_interface *intf);
0079 void gb_interface_put(struct gb_interface *intf);
0080 void gb_interface_mailbox_event(struct gb_interface *intf, u16 result,
0081 u32 mailbox);
0082
0083 int gb_interface_request_mode_switch(struct gb_interface *intf);
0084
0085 #endif