summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/interface.h
blob: 38210ad4e631f78e52be323689d68d6defa5a4db (plain) (blame)
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
58
59
60
61
62
63
64
65
66
/*
 * Greybus Interface Block code
 *
 * Copyright 2014 Google Inc.
 * Copyright 2014 Linaro Ltd.
 *
 * Released under the GPLv2 only.
 */

#ifndef __INTERFACE_H
#define __INTERFACE_H

/* Greybus "public" definitions" */
struct gb_interface {
	struct device dev;
	struct gb_control *control;

	struct list_head bundles;
	struct list_head links;	/* greybus_host_device->interfaces */
	struct list_head manifest_descs;
	u8 interface_id;	/* Physical location within the Endo */
	u8 device_id;		/* Device id allocated for the interface block by the SVC */

	/* Information taken from the manifest descriptor */
	u16 vendor;
	u16 product;
	char *vendor_string;
	char *product_string;
	u64 unique_id;

	/* Information taken from the hotplug event */
	u32 unipro_mfg_id;
	u32 unipro_prod_id;
	u32 ara_vend_id;
	u32 ara_prod_id;

	struct gb_module *module;
	struct greybus_host_device *hd;
};
#define to_gb_interface(d) container_of(d, struct gb_interface, dev)

static inline void gb_interface_set_drvdata(struct gb_interface *intf,
					    void *data)
{
	dev_set_drvdata(&intf->dev, data);
}

static inline void *gb_interface_get_drvdata(struct gb_interface *intf)
{
	return dev_get_drvdata(&intf->dev);
}

/* Greybus "private" definitions */

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

struct gb_interface *gb_interface_create(struct greybus_host_device *hd,
					 u8 interface_id);
void gb_interface_destroy(struct gb_interface *intf);
int gb_interface_init(struct gb_interface *intf, u8 device_id);
void gb_interface_remove(struct greybus_host_device *hd, u8 interface_id);
void gb_interfaces_remove(struct greybus_host_device *hd);

int gb_create_bundle_connection(struct gb_interface *intf, u8 class);
#endif /* __INTERFACE_H */