summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/module.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2014-12-21 14:10:26 -0800
committerGreg Kroah-Hartman <greg@kroah.com>2014-12-23 15:30:00 -0800
commitdf671553cbe286e885e61b61f8c126e034854a89 (patch)
tree848b1069b3bece302dd1803174f019d017999811 /drivers/staging/greybus/module.h
parent4901175f282792450f899b86b2d5d0048d6c11b2 (diff)
greybus: add module support
Modules in the greybus system sit above the interface, so insert them early in the sysfs tree. We dynamically create them when we have an interface that references a module, as we don't get a "module create" message directly. They also dynamically go away when the last interface associated with a module is removed. Naming scheme for modules/interfaces/bundles/connections is bumped up by one ':', and now looks like the following: /sys/bus/greybus $ tree . ├── devices │   ├── 7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7 │   ├── 7:7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7 │   ├── 7:7:0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7/7:7:0 │   └── 7:7:0:1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7/7:7:0/7:7:0:1 ├── drivers ├── drivers_autoprobe ├── drivers_probe └── uevent 6 directories, 3 files /sys/bus/greybus $ grep . devices/*/uevent devices/7/uevent:DEVTYPE=greybus_module devices/7:7/uevent:DEVTYPE=greybus_interface devices/7:7:0/uevent:DEVTYPE=greybus_bundle devices/7:7:0:1/uevent:DEVTYPE=greybus_connection We still have some "confusion" about interface ids and module ids, which will be cleaned up later when the svc control protocol changes die down, right now we just name a module after the interface as we don't have any modules that have multiple interfaces in our systems. This has been tested with gbsim. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/module.h')
-rw-r--r--drivers/staging/greybus/module.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/staging/greybus/module.h b/drivers/staging/greybus/module.h
new file mode 100644
index 000000000000..9ca7c2899a3f
--- /dev/null
+++ b/drivers/staging/greybus/module.h
@@ -0,0 +1,28 @@
+/*
+ * Greybus module code
+ *
+ * Copyright 2014 Google Inc.
+ *
+ * Released under the GPLv2 only.
+ */
+
+#ifndef __MODULE_H
+#define __MODULE_H
+
+/* Greybus "public" definitions" */
+struct gb_module {
+ struct device dev;
+
+ struct list_head list;
+ u8 module_id; /* Physical location within the Endo */
+};
+#define to_gb_module(d) container_of(d, struct gb_module, dev)
+
+struct greybus_host_device;
+
+/* Greybus "private" definitions */
+struct gb_module *gb_module_find_or_create(struct greybus_host_device *hd,
+ u8 module_id);
+
+
+#endif /* __MODULE_H */