summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/interface.h
blob: 567b6c8ae7131b80ea596823116c3ffd20625e99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Greybus Interface Block code
 *
 * Copyright 2014 Google Inc.
 * Copyright 2014 Linaro Ltd.
 *
 * Released under the GPLv2 only.
 */

#ifndef __INTERFACE_H
#define __INTERFACE_H

#define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES		BIT(0)
#define GB_INTERFACE_QUIRK_NO_INTERFACE_VERSION		BIT(1)
#define GB_INTERFACE_QUIRK_NO_INIT_STATUS		BIT(2)
#define GB_INTERFACE_QUIRK_NO_ARA_IDS			BIT(3)

struct gb_interface {
	struct device dev;
	struct gb_control *control;

	struct list_head bundles;
	struct list_head links;	/* gb_host_device->interfaces */
	struct list_head manifest_descs;
	u8 interface_id;	/* Physical location within the Endo */
	u8 device_id;

	u32 ddbl1_manufacturer_id;
	u32 ddbl1_product_id;
	u32 vendor_id;
	u32 product_id;
	u64 serial_number;

	u16 version_major;
	u16 version_minor;

	struct gb_host_device *hd;

	unsigned long quirks;

	bool disconnected;
};
#define to_gb_interface(d) container_of(d, struct gb_interface, dev)

struct gb_interface *gb_interface_find(struct gb_host_device *hd,
				       u8 interface_id);

struct gb_interface *gb_interface_create(struct gb_host_device *hd,
					 u8 interface_id);
int gb_interface_activate(struct gb_interface *intf);
void gb_interface_deactivate(struct gb_interface *intf);
int gb_interface_enable(struct gb_interface *intf);
void gb_interface_disable(struct gb_interface *intf);
int gb_interface_add(struct gb_interface *intf);
void gb_interface_remove(struct gb_interface *intf);

#endif /* __INTERFACE_H */