Commit Graph

55 Commits

Author SHA1 Message Date
Viresh Kumar 6f4219dd7d greybus: Documentation: Document Authentication interfaces
This patch defined userspace interface of the CAP protocol.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jun Li <li_jun@projectara.com>
Tested-by: Jun Li <li_jun@projectara.com>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-06 17:51:32 -05:00
Viresh Kumar 4ee48a5ecb greybus: firmware: prefix char-device with 'gb-'
This will make it consistent with any other character devices we have
for greybus and let us identify greybus character devices easily.

Compiled tested only.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-16 10:13:20 -07:00
Viresh Kumar df124299d1 greybus: firmware: Add license and copyright header to application
Add license and copyright header to the firmware.c test application.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-16 00:03:43 -07:00
Viresh Kumar 6554efa28e greybus: firmware: Fix spelling mistake
s/directly/directory :)

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-10 16:32:33 -07:00
Viresh Kumar 7a9a5bf01e greybus: Documentation/sysfs: gbphy0 is an invalid name
The numbering of gbphy devices is going to start from 1 and not 0.
Reflect the same in sysfs hierarchy.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-26 22:33:27 -07:00
Viresh Kumar 71b7a36072 greybus: Documentation/sysfs: Rename gpbridge to gbphy
These were left in the earlier renaming series, fix them as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-26 22:33:27 -07:00
Viresh Kumar 7bf7fa12fc greybus: Documentation: Document firmware-management interfaces
This patch adds a new 'firmware' folder in Documentation, which contains
two files:

- firmware-management: This describes the userspace interface for
  interacting with firmware-management bundle.

- firmware.c: Sample application to test firmware load for Interface
  Firmware and firmware updates to Backend Interface Firmware.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jun Li <li_jun@projectara.com>
Tested-by: Karthik Ravi Shankar <karthikrs@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-15 00:23:52 +02:00
Vaibhav Hiremath ceadf9def1 greybus: Documentation: Add sysfs information about bridged-phy device
Update the documentation (sysfs-bus-greybus) for recent conversion of
bridged-phy drivers to real drivers.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-05 13:38:57 -07:00
Viresh Kumar 0decdd55b3 greybus: Revert "interface: Fetch and expose version of interface's firmware"
This reverts commit b957ade7b3e4ab8c149c53346dbf02e977b7f3a7.

The interface version is now managed as part of the firmware-management
protocol. This operation is already removed from the greybus
specifications.

Drop interface version support from greybus.

Tested with gbsim (sysfs file not available after this patch).

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Acked-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-05 13:33:20 -07:00
Sandeep Patil 16ba59cedf greybus: Documentation/sysfs: fix sysfs paths
correct sysfs paths typo. (s/device/devices).

Signed-off-by: Sandeep Patil <sspatil@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-29 14:09:44 -07:00
Sandeep Patil dc9e9cf450 greybus: Documentation/sysfs: add entry for host device bus_id
Add description for greybus host device bus_id attribute

Signed-off-by: Sandeep Patil <sspatil@google.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-29 14:09:44 -07:00
Johan Hovold 36602a2981 greybus: module: implement controlled module removal
Implement controlled module removal through a new module attribute
"eject".

When a non-zero argument is written to the attribute, all interfaces of
the module are disabled (e.g. bundles are deregistered) and deactivated
(e.g. powered off) before instructing the SVC to physically eject the
module.

Note that the module device is not deregistered until the SVC has
reported the physical removal of all of its interfaces.

A new interface mutex is added to enforce interface state-change
serialisation.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 11:08:30 -07:00
Johan Hovold b15d97d770 greybus: core: add module abstraction
Add Greybus module abstraction that will be used to implement controlled
module removal (eject) and represent module geometry.

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, bundles, and control devices are consequently renamed as

        <bus_id>-<module_id>.<interface_id>
        <bus_id>-<module_id>.<interface_id>.<bundle_id>
        <bus_id>-<module_id>.<interface_id>.ctrl

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:

        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 until SVC module-size detection has been implemented, all
interfaces are considered to be part of 1x2 modules. Specifically, the
two interfaces of a 2x2 module will be presented as two 1x2 modules for
now.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 11:08:30 -07:00
Johan Hovold deba0c03e9 greybus: Documentation/sysfs: sort entries alphabetically
The attribute entries have been kept mostly sorted within each device
type. Let's move the three more-recently added interface attributes
that were not.

Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 11:08:30 -07:00
Johan Hovold 4ff80a59ac greybus: Documentation/sysfs: add entry for control device
Add an entry for the recently added interface control device.

Also move the bundle-device entry below the control-device entries.

Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 11:08:30 -07:00
Johan Hovold 7c8eb12dbb greybus: interface: move vendor and product strings to control device
The control device is an abstraction of the control connection over
which a greybus manifest is retrieved. As interfaces switch modes (e.g.
after boot-over-unipro) they expose new manifests, which can contain
different vendor and product strings.

Eventually control devices will be deregistered and recreated after an
interface mode switch, while the interface itself remains registered.

Note that only interfaces of type greybus will have control devices.
Specifically, dummy interfaces will not.

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>
2016-04-21 10:09:03 +09:00
Johan Hovold 078ef067bc greybus: Documentation/sysfs: add example control devices
Add control devices to the example sysfs tree.

Control devices are named

	<bus_id>-<module_id>.<intf_id>.ctrl

and expose attributes that are specific to the greybus interface type.
Specifically, dummy interfaces do not have a control device.

Currently, only the vendor and product strings extracted from the
manifest are exported.

A subtree of the example tree now looks as follows:

greybus1/
├── 1-5
│   ├── 1-5.5
│   │   ├── 1-5.5.2
│   │   │   ├── bundle_class
│   │   │   ├── bundle_id
│   │   │   └── state
│   │   ├── 1-5.5.ctrl
│   │   │   ├── product_string
│   │   │   └── vendor_string
│   │   ├── ddbl1_manufacturer_id
│   │   ├── ddbl1_product_id
│   │   ├── interface_id
│   │   ├── product_id
│   │   ├── serial_number
│   │   └── vendor_id
│   ├── 1-5.6
│   │   └── interface_id
│   ├── eject
│   ├── module_id
│   └── num_interfaces
└── 1-svc

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>
2016-04-21 10:03:13 +09:00
Johan Hovold 9e5e6fa6bf greybus: Documentation/sysfs: rename the svc eject attribute
The svc eject attribute was added as an interim solution and is still
used to implement a form of forced ejection.

This will soon be superseded by the module eject attribute, which will
provide an interface for clean eject. We may keep the forced-eject
mechanism around indefinitely, albeit possibly with a different name
(e.g. forced_intf_eject). Either way, update the example tree to reflect
the actual name, intf_eject, which currently used for this svc attribute.

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>
2016-04-21 10:03:13 +09:00
Johan Hovold 78b609b14c greybus: Documentation/sysfs: remove interface unique_id attribute
Remove the interface unique_id attribute, which there is currently no
plan to ever implement.

Note that the Ara serial numbers are already exposed through the
serial_number attribute.

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>
2016-04-21 10:03:13 +09:00
Johan Hovold aba2fc626e greybus: Documentation: move the interface power attributes
Move the interface power attributes after the other interface attributes
to keep the attributes grouped by device type.

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>
2016-04-21 10:03:13 +09:00
David Lin ddb10c8acc greybus: svc: add Interface power measurements support
This change implements the AP Power Monitor functions for obtaining
current/voltage/power on a specific rail of an Interface.

Testing Done:

$ cat /sys/bus/greybus/devices/1-3/current_now
103
$ cat /sys/bus/greybus/devices/1-3/power_now
303
$ cat /sys/bus/greybus/devices/1-3/voltage_now
203

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-07 21:37:59 -07:00
Johan Hovold c8733c513d greybus: Documentation/sysfs: make 1-5 a 2x2 module
Make example module 1-5 a 2x2 module by adding a second, dummy
interface.

This is both an example of how a 2x2 module would be represented and
also suggests what a dummy interface may look like.

A 2x2 module has two child interface devices and a num_interfaces value
of two.

In this example, the secondary interface 1-5.6, is a dummy interface and
therefore lacks the normal identifying attributes (e.g. UniPro DDBL1 and
Ara ids). We may eventually add an interface_type attribute to
facilitate distinguishing various interface types (there may be more
than two).

In the following tree, the bundle attributes and child devices have been
left out:

greybus1/
├── 1-2
│   ├── 1-2.2
│   │   ├── 1-2.2.1
│   │   ├── 1-2.2.2
│   │   ├── ddbl1_manufacturer_id
│   │   ├── ddbl1_product_id
│   │   ├── interface_id
│   │   ├── product_id
│   │   ├── serial_number
│   │   ├── unique_id
│   │   └── vendor_id
│   ├── eject
│   ├── module_id
│   └── num_interfaces
├── 1-5
│   ├── 1-5.5
│   │   ├── 1-5.5.2
│   │   ├── ddbl1_manufacturer_id
│   │   ├── ddbl1_product_id
│   │   ├── interface_id
│   │   ├── product_id
│   │   ├── serial_number
│   │   ├── unique_id
│   │   └── vendor_id
│   ├── 1-5.6
│   │   └── interface_id
│   ├── eject
│   ├── module_id
│   └── num_interfaces
└── 1-svc

In this example there are two modules: 1-2 is a 1x2 module with one
interface, and 1-5 is a 2x2 module with two interfaces of which the
second (1-5.6) is a dummy interface.

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>
2016-02-25 16:23:01 -08:00
Johan Hovold bd93d2a819 greybus: Documentation/sysfs: move module 1-4 to position 5
Move example module 1-4 to position 5, effectively renaming it 1-5.

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>
2016-02-25 16:23:01 -08:00
Johan Hovold 8886c44f87 greybus: Documentation/sysfs: add module devices
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>
2016-02-25 16:23:01 -08:00
Johan Hovold 737df280a7 greybus: Documentation: remove svc unique_id attribute
Remove unimplemented svc unique_id attribute from the documentation.

This attribute made more sense when we thought we'd have an AP-module,
unlike now when the AP and SVC are both part of the same frame.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-22 17:12:55 -08:00
Greg Kroah-Hartman d562853d3e greybus: svc watchdog: allow it to be enabled/disabled from userspace
Sometimes you want to disable the SVC watchdog without having to patch
your kernel, so provide a sysfs file to do this.  This can let us do
power measurements, and let the firmware developers not go crazy
worrying that the kernel is going to reset their chips with no notice.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-26 17:06:29 -08:00
Rui Miguel Silva 2c92bd5235 greybus: svc: add intf_eject attribute
Add a new write-only svc attribute to send an eject request to the svc
giving the interface number.

So, doing:
echo 3 > /sys/bus/greybus/devices/1-svc/intf_eject

will force eject the module on interface 3 (module slot 1 on EVT1).
This can take some seconds as the pulse width for module release is
large.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
2016-01-12 17:00:19 -08:00
Viresh Kumar d39bf704ac greybus: interface: Fetch and expose version of interface's firmware
The version of the currently running firmware on the module is useful
for userspace as it can be used to find if an update is available or
not. This patch fetches interface's version with a new control operation
and exposes the same in userspace.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-30 13:13:04 -08:00
Viresh Kumar 57c6bcc635 greybus: interface: Receive serial-number on hotplug event
Two exactly same modules can be uniquely identified using module's
serial-number. This patch updates the interface hotplug event to also
receive the serial-number of the module.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-30 13:13:04 -08:00
Viresh Kumar 0e9403a0fb greybus: interface: Expose DDBL1 manufacturing and production id in sysfs
These ids are already fetched from the SVC, but were never exposed to
sysfs. Userspace may be interested in using these values and hence these
must be exposed to it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-22 13:00:52 -08:00
Viresh Kumar c5b6df9c8d greybus: Documentation: Arrange entries in alphabetical order
The order of entries in sysfs-bus-greybus file doesn't match the order
files/directories in sysfs on a real board. More specifically, N-svc
comes at last and ap_interface_id comes before endo_id within the svc.

Fix that.

Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-04 16:22:40 -08:00
Viresh Kumar e6420dac3d greybus: Documentation: Fix N-svc directory name
endo_id was present in place of the directory N-svc, fix it.

Fixes: 4f7b1833e78f ("Documentation/sysfs-bus-greybus: update the bus ABI documentation")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-03 14:20:49 -08:00
Johan Hovold 32945d6ecc greybus: Documentation/sysfs: rename interface and bundle attributes
Update the example sysfs-tree layout under Documentation due renamed
interface and bundle attributes.

The interface and bundle "id" attributes have been renamed
"interface_id" and "bundle_id" respectively to make them self
describing. For consistency reasons the bundle class attribute is
renamed as "bundle_class".

.
├── greybus1
│   ├── 1-2
│   │   ├── 1-2.1
│   │   │   ├── bundle_class
│   │   │   ├── bundle_id
│   │   │   └── state
│   │   ├── 1-2.2
│   │   │   ├── bundle_class
│   │   │   ├── bundle_id
│   │   │   └── state
│   │   ├── interface_id
│   │   ├── product_id
│   │   ├── unique_id
│   │   └── vendor_id
│   ├── 1-4
│   │   ├── 1-4.2
│   │   │   ├── bundle_class
│   │   │   ├── bundle_id
│   │   │   ├── gpbridge0
│   │   │   │   ├── gpio
│   │   │   │   │   └── gpiochip490
│   │   │   │   └── i2c-4
│   │   │   └── state
│   │   ├── interface_id
│   │   ├── product_id
│   │   ├── unique_id
│   │   └── vendor_id
│   └── 1-svc
│       ├── ap_intf_id
│       ├── eject
│       ├── endo_id
│       └── unique_id
└── greybus2
    ├── 2-3
    │   ├── 2-3.1
    │   │   ├── bundle_class
    │   │   ├── bundle_id
    │   │   └── state
    │   ├── interface_id
    │   ├── product_id
    │   ├── unique_id
    │   └── vendor_id
    └── 2-svc
        ├── ap_intf_id
        ├── eject
        ├── endo_id
        └── unique_id

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:46:00 -08:00
Johan Hovold a97015c9e9 greybus: bundle: add bundle_id attribute
Add a bundle_id attribute for the interface-unique id of a bundle that
user space can use for matching.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:27:06 -08:00
Johan Hovold fda3412566 greybus: Documentation/sysfs-bus-greybus: update the bus ABI documentation
Update the ABI documentation to match the new device model.

Note that the SVC unique_id and version attributes are not yet
implemented.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:27:06 -08:00
Johan Hovold f6f8aeaa35 greybus: Documentation/sysfs: update the example sysfs tree
Update the example sysfs-tree layout under Documentation.

The new layout reflects changes to the kernel device-model that are
needed to eventually be able to handle multiple AP-bridges.

The example tree has two AP-bridges, each with its own view of the
UniPro network, the bus.

.
├── greybus1
│   ├── 1-2
│   │   ├── 1-2.1
│   │   │   ├── class
│   │   │   ├── id
│   │   │   └── state
│   │   ├── 1-2.2
│   │   │   ├── class
│   │   │   ├── id
│   │   │   └── state
│   │   ├── id
│   │   ├── product_id
│   │   ├── unique_id
│   │   └── vendor_id
│   ├── 1-4
│   │   ├── 1-4.2
│   │   │   ├── class
│   │   │   ├── gpbridge0
│   │   │   │   ├── gpio
│   │   │   │   │   └── gpiochip490
│   │   │   │   └── i2c-4
│   │   │   ├── id
│   │   │   └── state
│   │   ├── id
│   │   ├── product_id
│   │   ├── unique_id
│   │   └── vendor_id
│   └── 1-svc
│       ├── ap_intf_id
│       ├── eject
│       ├── endo_id
│       └── unique_id
└── greybus2
    ├── 2-3
    │   ├── 2-3.1
    │   │   ├── class
    │   │   ├── id
    │   │   └── state
    │   ├── id
    │   ├── product_id
    │   ├── unique_id
    │   └── vendor_id
    └── 2-svc
        ├── ap_intf_id
        ├── eject
        ├── endo_id
        └── unique_id

Every bus has exactly one svc device (1-svc and 2-svc). For our system,
the svc device of each bus will be a representation of the same
network-unique SVC device (e.g. endo_id and unique_id will be
identical).

The first bus has two registered interfaces (1-2 and 1-4), while the
second bus has a single interface (2-3). Note that the interface ids (2,
4, and 3) are necessarily unique as these are interfaces on the same
network.

Interface 1-2 has two bundles (1-2.1 and 1-2.2) and interface 1-4 has
a single bundle (1-4.2). The bundle ids are interface-unique and reflect
the ids found in each manifest.

In the example, bundle 1-4.2 has a gbbridge-device, which is the parent
device for a gpiochip device and an i2c bus.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-23 19:24:27 -08:00
Johan Hovold 8034bd561d greybus: interface: remove unique id
Remove the unimplemented interface unique-id.

There will eventually be an interface-serial-number attribute provided,
but let's not export it or commit to a name for this attribute until we
need it.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Greg Kroah-Hartman b750fa3370 greybus: connection: remove 'struct device' from 'struct gb_connection'
We don't want this in the driver core, as nothing will be binding to it,
that's the job of a bundle.  So remove the struct device and use a kref
to handle reference counting instead.

Note, I don't think we really need a kref, but it keeps the lifetime the
same as before, and is the simplest change for now.  In the future it
might be easier to just attach all connections to the bundle and clean
them up when the bundle is removed.

Also remove the cport sysfs documentation as it's no longer relevant.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2015-10-19 12:09:10 -07:00
Viresh Kumar 2e49b15763 greybus: Documentation: Update sysfs-bus-greybus
The file names here weren't in sync with what we have today and the
updates give a better picture of the same.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-17 14:52:43 -07:00
Viresh Kumar 8552ca0f36 greybus: connection: Add sysfs 'ap_cport_id' file for connections
Its a very useful piece of information, i.e. the cport id of the AP to
which the cport of the module is connected, and is required lots of
times. It isn't known in advance as it is allocated at runtime.

This patch creates another file 'ap_cport_id', only for the connection
directories, which will give the cport id of the AP.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-14 21:29:01 -07:00
Viresh Kumar c3add7883c greybus: interface: device_id belongs to the interface
While introducing bundles, the device_id also got moved to the bundle,
whereas it identifies an interface block to the AP.

Move it back to interface instead of bundle.

Calls to gb_bundle(s)_init() are dropped as connections will be
initialized while they are created now, as device_id will be valid.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-01 16:38:42 -07:00
Alex Elder e6cebf8770 greybus: endo: delete "0xXXXX" portion in sysfs "endo" directory
With the Endo "id" attribute in place, there's no need to encode
the ID of an Endo in its sysfs path.  So get rid of it.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-28 14:45:56 -07:00
Alex Elder 312bb84942 greybus: endo: drop redundant prefixes from sysfs basenames
This commit:
    7e761e2 endo: rework some attributes
added a new "endo_id" attribute, located under a new "Endo"
directory in sysfs.  The resulting path looks like:
    Documentation/sysfs/endo-TYPE/Endo/endo_id
There's no need to have a separate "Endo" subdirectory to contain
Endo-specific attributes.

That commit also added "svc_" to some other paths related to the
SVC, like:
    Documentation/sysfs/endo-TYPE/SVC/svc_version
The additional "svc_" is redundant.

This patch retouches those paths a bit, mainly to remove some
redundancy.  It also makes the pathname components all lower case.
As a result, the above two paths now look like:
    Documentation/sysfs/endo-TYPE/id
    Documentation/sysfs/endo-TYPE/svc/version

All other Endo sysfs files are updated similarly.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-28 14:45:56 -07:00
Alex Elder 28e3cedcce greybus: update sysfs documentation files
Impose a few editorial conventions on the Greybus-related sysfs
files under "Documentation".
    - Capitalize "Endo" (except in path names)
    - Capitalize "ID" (except in path names)
    - Use "..." to indicate unspecified path components (because
      ".." means something else).
    - Add the "0x" prior to the "XXXX" representing the Endo ID.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-28 14:45:56 -07:00
Alex Elder b4dbf1e132 greybus: add documentation for Endo sysfs files
Update the files documenting Greybus-related sysfs files under
Documentation/ to reflect the addition of the two recently-added
Endo attributes.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-28 14:45:20 -07:00
Greg Kroah-Hartman 75052a5504 greybus: bundle: add state sysfs file
A bundle has a state file, that is managed by the endo userspace
process.  This file can be written to and any process that is polling on
the file will be woken up and can read the new value.  It's a "cheap"
IPC for programs that are not allowed to do anything other than
read/write to kernel sysfs files.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-17 16:12:49 +02:00
Greg Kroah-Hartman b0235b2263 greybus: Documentation/sysfs-bus-greybus: document module sysfs files
This documents the module slot sysfs files "epm", "power_control", and
"present".

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-04-09 22:50:10 +02:00
Greg Kroah-Hartman 7baa184dbd greybus: Documentation/sysfs-bus-greybus: document the endo and SVC
This documents the endo device, and the SVC specific files that are
present in the sysfs device tree.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-04-09 22:50:09 +02:00
Greg Kroah-Hartman f0b678709a greybus: Documentation/sysfs-bus-greybus: update kernel version and date
The kernel is now on the 4.XX numbering scheme, and it's going to be a
while before we merge this code, so pick a date sometime in the future
to be safe.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-04-09 22:50:09 +02:00
Greg Kroah-Hartman 6023629d36 greybus: Documentation/sysfs: add a proposed sysfs tree for greybus
This adds a proposed sysfs layout for greybus to Documentation to make
it easier for people to discuss / test things.  It includes a module, an
interface, a bundle, and a gpbridge binding to that bundle.

This was discussed on the projectara software mailing list.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-04 10:54:25 +02:00