Introduce module devices and rename interface and bundle devices.
Greybus module devices correspond to physical modules and have one or
more interfaces. Modules have an id that is identical to the id of their
primary interface, which in turn is the interface with lowest numbered
id. The module name is constructed from the bus and module id:
<bus_id>-<module_id>
Interfaces and bundles are consequently renamed as
<bus_id>-<module_id>.<interface_id>
and
<bus_id>-<module_id>.<interface_id>.<bundle_id>
respectively.
As before, interface ids (and therefore in a sense now also module ids)
correspond to physical interface positions on the frame.
Modules have the following attributes:
eject
module_id
num_interfaces
where module_id is the id of the module and num_interface the number of
interfaces the module has.
Note that the interface ids of a module's interfaces are expected to be
<module_id>, <module_id + 1>, ..., <module_id + num_interfaces - 1>.
Writing a non-zero argument to eject cleanly shuts down and unregisters
all of the module interfaces before ejecting the module.
The example sysfs tree now looks as follows with the second bus
(APBridgeA) left out:
greybus1/
├── 1-2
│ ├── 1-2.2
│ │ ├── 1-2.2.1
│ │ │ ├── bundle_class
│ │ │ ├── bundle_id
│ │ │ └── state
│ │ ├── 1-2.2.2
│ │ │ ├── bundle_class
│ │ │ ├── bundle_id
│ │ │ └── state
│ │ ├── ddbl1_manufacturer_id
│ │ ├── ddbl1_product_id
│ │ ├── interface_id
│ │ ├── product_id
│ │ ├── serial_number
│ │ ├── unique_id
│ │ └── vendor_id
│ ├── eject
│ ├── module_id
│ └── num_interfaces
├── 1-4
│ ├── 1-4.4
│ │ ├── 1-4.4.2
│ │ │ ├── bundle_class
│ │ │ ├── bundle_id
│ │ │ ├── gpbridge0
│ │ │ │ ├── gpio
│ │ │ │ │ └── gpiochip490
│ │ │ │ └── i2c-4
│ │ │ └── state
│ │ ├── ddbl1_manufacturer_id
│ │ ├── ddbl1_product_id
│ │ ├── interface_id
│ │ ├── product_id
│ │ ├── serial_number
│ │ ├── unique_id
│ │ └── vendor_id
│ ├── eject
│ ├── module_id
│ └── num_interfaces
└── 1-svc
├── ap_intf_id
├── eject
└── endo_id
where greybus1 is a bus; 1-svc the svc; 1-2, and 1-4 are modules; 1-2.2
and 1-4.4 are (primary) interfaces; and 1-2.2.1, 1-2.2.2, and 1-4.4.2
are bundles.
Note that the svc eject attribute may eventually be renamed force_eject.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>