]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/staging/greybus/interface.h
staging: greybus: add SPDX identifiers to all greybus driver files
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / greybus / interface.h
CommitLineData
eb50fd3a 1// SPDX-License-Identifier: GPL-2.0
e1e9dbdd 2/*
4ec7b079 3 * Greybus Interface Block code
e1e9dbdd
AE
4 *
5 * Copyright 2014 Google Inc.
a46e9671 6 * Copyright 2014 Linaro Ltd.
e1e9dbdd
AE
7 *
8 * Released under the GPLv2 only.
9 */
10
a93938a2
GKH
11#ifndef __INTERFACE_H
12#define __INTERFACE_H
e1e9dbdd 13
a212b758
JH
14enum gb_interface_type {
15 GB_INTERFACE_TYPE_INVALID = 0,
16 GB_INTERFACE_TYPE_UNKNOWN,
17 GB_INTERFACE_TYPE_DUMMY,
18 GB_INTERFACE_TYPE_UNIPRO,
19 GB_INTERFACE_TYPE_GREYBUS,
20};
21
ec199ccd 22#define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES BIT(0)
792db396 23#define GB_INTERFACE_QUIRK_NO_INIT_STATUS BIT(1)
23931ffb 24#define GB_INTERFACE_QUIRK_NO_GMP_IDS BIT(2)
d9fa3494 25#define GB_INTERFACE_QUIRK_FORCED_DISABLE BIT(3)
55742d2a 26#define GB_INTERFACE_QUIRK_LEGACY_MODE_SWITCH BIT(4)
47cbaf5e 27#define GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE BIT(5)
0c543f9b 28#define GB_INTERFACE_QUIRK_NO_PM BIT(6)
ec199ccd 29
4ab9b3c2 30struct gb_interface {
e1e9dbdd 31 struct device dev;
cdee4f75 32 struct gb_control *control;
e1e9dbdd 33
e232b791 34 struct list_head bundles;
b15d97d7 35 struct list_head module_node;
86cad666 36 struct list_head manifest_descs;
df671553 37 u8 interface_id; /* Physical location within the Endo */
e9f2f688 38 u8 device_id;
8c81d460 39 u8 features; /* Feature flags set in the manifest */
a212b758
JH
40
41 enum gb_interface_type type;
e1e9dbdd 42
b32a5c53
VK
43 u32 ddbl1_manufacturer_id;
44 u32 ddbl1_product_id;
9f59263a
JH
45 u32 vendor_id;
46 u32 product_id;
57c6bcc6 47 u64 serial_number;
3944a454 48
2537636a 49 struct gb_host_device *hd;
b15d97d7 50 struct gb_module *module;
1575ef18 51
ec199ccd
JH
52 unsigned long quirks;
53
36602a29
JH
54 struct mutex mutex;
55
141af4f0 56 bool disconnected;
55742d2a 57
36602a29 58 bool ejected;
12169bc9 59 bool removed;
1e1565e5 60 bool active;
49605839 61 bool enabled;
55742d2a 62 bool mode_switch;
27b9e257 63 bool dme_read;
55742d2a
JH
64
65 struct work_struct mode_switch_work;
66 struct completion mode_switch_completion;
e1e9dbdd 67};
4ab9b3c2 68#define to_gb_interface(d) container_of(d, struct gb_interface, dev)
e1e9dbdd 69
b15d97d7 70struct gb_interface *gb_interface_create(struct gb_module *module,
6c68da26 71 u8 interface_id);
4d5f6218
JH
72int gb_interface_activate(struct gb_interface *intf);
73void gb_interface_deactivate(struct gb_interface *intf);
35580af0 74int gb_interface_enable(struct gb_interface *intf);
629c0d00 75void gb_interface_disable(struct gb_interface *intf);
7a137fb2 76int gb_interface_add(struct gb_interface *intf);
b15d97d7
JH
77void gb_interface_del(struct gb_interface *intf);
78void gb_interface_put(struct gb_interface *intf);
55742d2a
JH
79void gb_interface_mailbox_event(struct gb_interface *intf, u16 result,
80 u32 mailbox);
81
82int gb_interface_request_mode_switch(struct gb_interface *intf);
13e6aacf 83
a93938a2 84#endif /* __INTERFACE_H */