summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/interface.h
blob: 5c7cebc17e2e0ce3842e4a3d6633f5e709490c2c (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
58
/*
 * Greybus Interface Block code
 *
 * Copyright 2014 Google Inc.
 * Copyright 2014 Linaro Ltd.
 *
 * Released under the GPLv2 only.
 */

#ifndef __INTERFACE_H
#define __INTERFACE_H

/* Increase these values if needed */
#define MAX_CPORTS_PER_MODULE	10
#define MAX_STRINGS_PER_MODULE	10


/* Greybus "public" definitions" */
struct gb_interface_block {
	struct device dev;

	struct list_head bundles;
	struct list_head links;	/* greybus_host_device->modules */
	u8 module_id;		/* Physical location within the Endo */

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

	struct greybus_host_device *hd;
};
#define to_gb_interface_block(d) container_of(d, struct gb_interface_block, dev)

static inline void
gb_interface_block_set_drvdata(struct gb_interface_block *gb_ib, void *data)
{
	dev_set_drvdata(&gb_ib->dev, data);
}

static inline void *
gb_interface_block_get_drvdata(struct gb_interface_block *gb_ib)
{
	return dev_get_drvdata(&gb_ib->dev);
}

/* Greybus "private" definitions */

const struct greybus_interface_block_id *
	gb_ib_match_id(struct gb_interface_block *gb_ib,
		       const struct greybus_interface_block_id *id);

struct gb_interface_block *gb_ib_find(struct greybus_host_device *hd,
				      u8 module_id);

#endif /* __INTERFACE_H */