platform/kernel/linux-rpi.git
8 years agogreybus: uart: Update line coding settings only when needed
Axel Haslam [Wed, 20 Apr 2016 18:47:20 +0000 (20:47 +0200)]
greybus: uart: Update line coding settings only when needed

The check for line coding changed should use memcmp and not memcpy.

Testing done: trivial

Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: remove interface-remove helper
Johan Hovold [Wed, 13 Apr 2016 17:19:09 +0000 (19:19 +0200)]
greybus: svc: remove interface-remove helper

Remove unnecessary interface-remove helper.

Also add comment about why the disconnected flag is set.

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>
8 years agogreybus: svc: keep interfaces registered during mode switch
Johan Hovold [Wed, 13 Apr 2016 17:19:08 +0000 (19:19 +0200)]
greybus: svc: keep interfaces registered during mode switch

Keep a detected interface registered until it is physically removed.
Specifically, do not re-register an interface that is switching mode.

Note that this also allows us to get rid of some nasty hacks from core.
The Ara VID/PID bootrom hack for ES2 will continue to work, but is now
mostly confined to the bootrom driver.

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>
8 years agogreybus: svc: make sure to deactivate all interfaces on disconnect
Johan Hovold [Wed, 13 Apr 2016 17:19:07 +0000 (19:19 +0200)]
greybus: svc: make sure to deactivate all interfaces on disconnect

Make sure to deactivate all interfaces when the svc is going away.

This is needed to eventually be able to do controlled teardown of the
unipro network.

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>
8 years agogreybus: interface: reduce control-device lifetime
Johan Hovold [Wed, 13 Apr 2016 17:19:06 +0000 (19:19 +0200)]
greybus: interface: reduce control-device lifetime

Make the control-device lifetime coincide with when the interface is
enabled (enumerated).

This is needed to be able register a new control device after a mode
switch.

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>
8 years agogreybus: control: return error pointer when failing to create control device
Johan Hovold [Wed, 13 Apr 2016 17:19:05 +0000 (19:19 +0200)]
greybus: control: return error pointer when failing to create control device

Return an error pointer when failing to create a control device.

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>
8 years agogreybus: interface: move vendor and product strings to control device
Johan Hovold [Wed, 13 Apr 2016 17:19:04 +0000 (19:19 +0200)]
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>
8 years agogreybus: interface: register control device at hotplug
Johan Hovold [Wed, 13 Apr 2016 17:19:03 +0000 (19:19 +0200)]
greybus: interface: register control device at hotplug

Make sure to register also the control device along with any bundles
when registering an interface.

Note that we currently ignore failures to register the control device
just as we do for bundle devices.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: core: make the control object be a device
Johan Hovold [Wed, 13 Apr 2016 17:19:02 +0000 (19:19 +0200)]
greybus: core: make the control object be a device

Make the control object be a greybus device.

The control device will be used to expose attributes specific to
greybus-type interfaces.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: control: move timesync-operation functions
Johan Hovold [Wed, 13 Apr 2016 17:19:01 +0000 (19:19 +0200)]
greybus: control: move timesync-operation functions

Move the timesync-operation functions above the control-object
management functions, which is where all other operation implementations
reside.

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>
8 years agogreybus: interface: disable interface on registration failures
Johan Hovold [Wed, 13 Apr 2016 17:19:00 +0000 (19:19 +0200)]
greybus: interface: disable interface on registration failures

Disable and deactivate an interface immediately on registration
failures.

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>
8 years agogreybus: Documentation/sysfs: add example control devices
Johan Hovold [Wed, 13 Apr 2016 17:18:59 +0000 (19:18 +0200)]
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>
8 years agogreybus: Documentation/sysfs: rename the svc eject attribute
Johan Hovold [Wed, 13 Apr 2016 17:18:58 +0000 (19:18 +0200)]
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>
8 years agogreybus: Documentation/sysfs: remove interface unique_id attribute
Johan Hovold [Wed, 13 Apr 2016 17:18:57 +0000 (19:18 +0200)]
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>
8 years agogreybus: Documentation: move the interface power attributes
Johan Hovold [Wed, 13 Apr 2016 17:18:56 +0000 (19:18 +0200)]
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>
8 years agogreybus: manifest: fix illegal free in error path
Johan Hovold [Wed, 13 Apr 2016 17:18:55 +0000 (19:18 +0200)]
greybus: manifest: fix illegal free in error path

The manifest-parsing code could end up leaving the interface
vendor_string set to an error pointer that we'd eventually try to free
when destroying the 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>
8 years agogreybus: spi: use timeout request send operation
Rui Miguel Silva [Wed, 20 Apr 2016 13:40:23 +0000 (14:40 +0100)]
greybus: spi: use timeout request send operation

When transfer speed is too slow (less than 17Khz) the operation can take
longer than the default greybus timeout. Because of this we need to use
the request_send_sync_timeout and calculate the correct timeout for each
operation.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Tested-by: Philip Yang <philipy@bsquare.com>
Tested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: spi: fix message transfer over greybus
Rui Miguel Silva [Wed, 20 Apr 2016 13:40:22 +0000 (14:40 +0100)]
greybus: spi: fix message transfer over greybus

The actual implementation of transfer_one_message have problems with
some cases in the possible transfer options. We try to maximize the
number of spi transfers in one greybus operation and need to save state
until the full message is dispatch over greybus.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Tested-by: Philip Yang <philipy@bsquare.com>
Tested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc watchdog: Disable watchdog upon entering suspend
David Lin [Fri, 15 Apr 2016 19:45:16 +0000 (01:15 +0530)]
greybus: svc watchdog: Disable watchdog upon entering suspend

SVC watchdog should be disabled when device is entering suspend mode.

Testing done:
 - Sanity tested on EVT1.5
 - Check no SVC ping during the suspend process
 - Check SVC watchdog is back on pinging once device is resumed

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
[vaibhav.hiremath@linaro.org: Removed unwanted check in notifier callback and
Updated commit description]
Tested-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: arche-platform: Power-off unipro subsystem upon suspend
David Lin [Fri, 15 Apr 2016 19:45:15 +0000 (01:15 +0530)]
greybus: arche-platform: Power-off unipro subsystem upon suspend

Switch off APBs/SVC/Switch in the suspend call notifier. Note that
this is an interim solution to enable fishfooding.

Testing done:
 - Passed QA sanity test on EVT1.5
 - Suspend current measured at ~70mW

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
[vaibhav.hiremath@linaro.org: Updated commit description]
Tested-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: Fixup __u64, __u32 to __le64, __le32 in timesync declarations
Bryan O'Donoghue [Tue, 12 Apr 2016 16:15:11 +0000 (17:15 +0100)]
greybus: Fixup __u64, __u32 to __le64, __le32 in timesync declarations

A number of data in TimeSync command structures are declared __u64/__u32
instead of __le64/__le32, I forgot to put this through an x86_64 compile
before presentation for merge and as a result didn't catch this error. This
patch fixes.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: arche-platfrom: Get rid of 2sec delay in USB3613 configuration
Vaibhav Hiremath [Tue, 12 Apr 2016 11:48:47 +0000 (17:18 +0530)]
greybus: arche-platfrom: Get rid of 2sec delay in USB3613 configuration

Earlier during boot sequence implementation, we had seen race between
USb3613 and APB boot, and since APB boot time is ~2sec, we delayed
USb3613 configuration for 2sec after APB deassertion of reset.

This obviously won't work in the case of suspend/resume, where we would
like to put APB into OFF state and coldboot in resume.

With the latest FW changes, we do not see any race issue. I have done
regression testing (> 50 iteration of reboot + unipro link up and down)
without any issues.

So lets get rid of the 2sec delay with this patch.

Testing Done: Tested on EVT 1.5 platform.

Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Tested-by: David Lin <dtwlin@google.com>
Reviewed-by: David Lin <dtwlin@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera-gb: Extend the configure streams interface
Evgeniy Borisov [Wed, 6 Apr 2016 12:22:45 +0000 (15:22 +0300)]
greybus: camera-gb: Extend the configure streams interface

Extending the configure streams interface with CSI params.
Getting CSI frequency data form configure streams response.
 * num_lanes - Number of CSI data lanes
 * clk_freq - CSI clock frequency in Hz
 * lines_per_second - Total number of lines in a second of
transmission (blanking included)

From the AP side we need to know for the CSI speed
configuration. This information is needed for dynamically
bandwidth calculations.

NOTE: Change should be along merged with corresponding
      interface change in kernel:
      "camera: Extend the configure streams
      interface with CSI params"

Signed-off-by: Evgeniy Borisov <eborisov@mm-sol.com>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: add Interface power measurements support
David Lin [Fri, 8 Apr 2016 03:15:30 +0000 (20:15 -0700)]
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>
8 years agogreybus: audio: Update device type based on widget types
Vaibhav Agarwal [Wed, 30 Mar 2016 07:53:56 +0000 (13:23 +0530)]
greybus: audio: Update device type based on widget types

Device type info shared to above HAL is currently hard coded
to SPK only. Actual device type is identifed while parsing
widget types from topology FW shared by codec module.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio_manager: Split device type into i/p & o/p devices
Vaibhav Agarwal [Wed, 30 Mar 2016 07:53:55 +0000 (13:23 +0530)]
greybus: audio_manager: Split device type into i/p & o/p devices

Currently, single field is used to report device type say SPK,
MIC, HS, HP, etc. However above HAL expects separate fields for
input & ouput device types.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera: Add metadata format
Gjorgji Rosikopulos [Fri, 1 Apr 2016 14:32:43 +0000 (17:32 +0300)]
greybus: camera: Add metadata format

Add support for greybus metadata format.
Greybus metadata format id is 0x41.

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Acked-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: firmware: Rename to bootrom protocol
Viresh Kumar [Sun, 3 Apr 2016 06:48:35 +0000 (12:18 +0530)]
greybus: firmware: Rename to bootrom protocol

Align with Greybus specifications and rename Firmware Protocol driver as
Bootrom Protocol driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: checkpatch.pl: Mark --no-tree as default option
Viresh Kumar [Fri, 1 Apr 2016 05:45:42 +0000 (11:15 +0530)]
greybus: checkpatch.pl: Mark --no-tree as default option

Don't know why, but checkpatch checks if we are running it from top of a
kernel tree or not, but then it also provides an option to suppress the
warning using --no-tree.

Instead of forcing everyone to use this every time, lets make this
behavior default.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: Revert "Added a sysfs entry to power down the SVC"
Akash Choudhari [Sat, 2 Apr 2016 03:10:01 +0000 (20:10 -0700)]
greybus: Revert "Added a sysfs entry to power down the SVC"

This reverts commit a1d8f2c3856804ed26157104bb203edf4c882a6c.

8 years agogreybus: Added a sysfs entry to power down the SVC
Georgi Dobrev [Thu, 24 Mar 2016 11:37:21 +0000 (13:37 +0200)]
greybus: Added a sysfs entry to power down the SVC

Added a sysfs entry called pwr_off. When a "1" is passed to it,
it sends a GB_SVC_TYPE_PWR_DOWN command to the SVC, powering it down
along with the switch and INA231 chips.

Testing Done: Tested on EVT1_5, works.

Signed-off-by: Georgi Dobrev <dobrev_georgi@projectara.com>
8 years agogreybus: scripts: create subdir for checkpatch and spelling.txt
Greg Kroah-Hartman [Fri, 1 Apr 2016 05:35:24 +0000 (22:35 -0700)]
greybus: scripts: create subdir for checkpatch and spelling.txt

They belong in a subdir.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: trivial: add checkpatch.pl to the tree
Greg Kroah-Hartman [Fri, 1 Apr 2016 05:26:39 +0000 (22:26 -0700)]
greybus: trivial: add checkpatch.pl to the tree

For those who are stuck using old kernel trees, let's include the latest
version of checkpatch.pl into our tree to help prevent coding style
mistakes from creeping in.

Also add spelling.txt to catch spelling errors in comments.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: Add I2S_RX path related settings
Vaibhav Agarwal [Tue, 29 Mar 2016 11:02:37 +0000 (16:32 +0530)]
greybus: audio: Add I2S_RX path related settings

Capture path related settings during startup, perpare &
hwparams were earlier missing.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: Added jack support to audio module
Vaibhav Agarwal [Tue, 29 Mar 2016 11:02:36 +0000 (16:32 +0530)]
greybus: audio: Added jack support to audio module

Register jack with ASoC sound card in case audio module
populates it via codec FW. Currently, only a single jack
with 4 buttons can be registered for each module.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: Fix widget pointer update during control parsing
Vaibhav Agarwal [Tue, 29 Mar 2016 11:02:35 +0000 (16:32 +0530)]
greybus: audio: Fix widget pointer update during control parsing

widget pointer was incorrectly modfied while parsing kcontrol

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera: Use pointer for gb camera module ops
Gjorgji Rosikopulos [Thu, 31 Mar 2016 11:12:45 +0000 (14:12 +0300)]
greybus: camera: Use pointer for gb camera module ops

No need to duplicate module ops on every registration.

NOTE: Change should be along merged with:
"msm: camera: Change gb_camera_module ops to pointer"

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: add Ara serial-number support
Johan Hovold [Tue, 29 Mar 2016 22:56:12 +0000 (18:56 -0400)]
greybus: interface: add Ara serial-number support

Add support for reading the Ara serial-number attributes.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: clean up DME attribute handling
Johan Hovold [Tue, 29 Mar 2016 22:56:11 +0000 (18:56 -0400)]
greybus: interface: clean up DME attribute handling

Move all DME defines to the interface code and rename them using common
prefixes (e.g. DME_T and DME_TOSHIBA).

The DDB L1 attributes are defined by MIPI and the Ara attributes are
currently Toshiba specific so move them all out of the Greybus protocol
header.

Also rename the Greybus init-status values using a GB_INIT prefix.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: clean up ES2 VID/PID hack
Johan Hovold [Tue, 29 Mar 2016 22:56:10 +0000 (18:56 -0400)]
greybus: interface: clean up ES2 VID/PID hack

Clean up the ES2 VID/PID hack using a new quirk flag.

Note that the hack is now used if and only if the interface is a Toshiba
ES2 bridge (and not if the attributes read zero).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: add ES2 init-status quirk flag
Johan Hovold [Tue, 29 Mar 2016 22:56:09 +0000 (18:56 -0400)]
greybus: interface: add ES2 init-status quirk flag

Add ES2 init-status quirk flag instead of checking MID/PID directly.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: read DME attributes at activation
Johan Hovold [Tue, 29 Mar 2016 22:56:08 +0000 (18:56 -0400)]
greybus: interface: read DME attributes at activation

Read the DDBL1 and Ara DME attributes when activating an interface.

These values are currently provided by the SVC in the intf_hotplug
request, which is about to go away.

Note that there are currently no standard Ara VID and PID attributes and
that Toshiba uses attributes from the reserved space in ES3. For now, we
therefore refuse to enumerate any non-Toshiba bridges.

Also note that the Ara serial number is currently not supported.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_protocols: rename NULL DME selector index
Johan Hovold [Tue, 29 Mar 2016 22:56:07 +0000 (18:56 -0400)]
greybus: greybus_protocols: rename NULL DME selector index

Add NULL suffix to the don't-care DME selector index.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: clean up device-id handling
Johan Hovold [Tue, 29 Mar 2016 22:56:06 +0000 (18:56 -0400)]
greybus: interface: clean up device-id handling

Clean up the device id-handling and make sure we never allocate invalid
device ids due to a missing upper bound.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: deactivate interface on enumeration failure
Johan Hovold [Tue, 29 Mar 2016 22:56:05 +0000 (18:56 -0400)]
greybus: interface: deactivate interface on enumeration failure

Deactivate an interface immediately on enumeration failure.

Note that an interface is always registered.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: move route creation to interface activation
Johan Hovold [Tue, 29 Mar 2016 22:56:04 +0000 (18:56 -0400)]
greybus: interface: move route creation to interface activation

Creating and destroying a route to an interface is arguably an interface
operation and belongs with the interface code.

Add new interface_activate and interface_deactivate helpers that will be
used to activate and deactivate an interface in the new interface boot
sequence.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: clean up ES3-bootroom-quirk handling
Johan Hovold [Tue, 29 Mar 2016 22:56:03 +0000 (18:56 -0400)]
greybus: interface: clean up ES3-bootroom-quirk handling

Clean up handling of the ES3-bootrom quirks by adding an interface
quirk-flags field that is set appropriately when we detect that the ES3
bootrom is running.

Note that we need to reserve the DME_DIS_UNIPRO_BOOT_STARTED and
DME_DIS_FALLBACK_UNIPRO_BOOT_STARTED status values for the ES3 bootrom,
which does not support any CPort features (unlike later boot stages).
Add a BOOTROM infix to the defines to make this more clear.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: clean up and rename init-status helper
Johan Hovold [Tue, 29 Mar 2016 22:56:02 +0000 (18:56 -0400)]
greybus: interface: clean up and rename init-status helper

Clean up and rename the interface-init-status helper.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: fix es2 boot-status mask
Johan Hovold [Tue, 29 Mar 2016 22:56:01 +0000 (18:56 -0400)]
greybus: interface: fix es2 boot-status mask

The ES2 boot status is stored in the least significant byte.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: move boot-status clearing to interface enable
Johan Hovold [Tue, 29 Mar 2016 22:56:00 +0000 (18:56 -0400)]
greybus: interface: move boot-status clearing to interface enable

Reading and clearing the boot status of an interface is an interface
operation and belongs in the interface code.

As part of the reworked interface boot sequence, we also want to do this
when enabling (enumerating) a Greybus interface.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: indent CPort flag defines properly
Johan Hovold [Tue, 29 Mar 2016 22:55:59 +0000 (18:55 -0400)]
greybus: svc: indent CPort flag defines properly

Use tabs to indent CPort-flag values.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_protocols: remove bogus comment about svc bundle
Johan Hovold [Tue, 29 Mar 2016 22:55:58 +0000 (18:55 -0400)]
greybus: greybus_protocols: remove bogus comment about svc bundle

The SVC connection is special and does not belong to neither an
interface or a bundle.

Remove the unused SVC bundle-id define.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: remove bogus interface-reset helper
Johan Hovold [Tue, 29 Mar 2016 22:55:57 +0000 (18:55 -0400)]
greybus: svc: remove bogus interface-reset helper

Remove unused, bogus interface-reset helper.

The interface-reset operation is initiated by the SVC, not the AP.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_protocols: align DME-attribute values
Johan Hovold [Tue, 29 Mar 2016 22:55:56 +0000 (18:55 -0400)]
greybus: greybus_protocols: align DME-attribute values

Align the DME-attribute values in the protocol header.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: core: fix two container-of macros
Johan Hovold [Wed, 30 Mar 2016 20:53:17 +0000 (16:53 -0400)]
greybus: core: fix two container-of macros

Fix two greybus container-of macros that used the pointer name for the
member.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: fix to resolve multiple audio module playback issue
Vaibhav Agarwal [Tue, 29 Mar 2016 18:01:43 +0000 (23:31 +0530)]
greybus: audio: fix to resolve multiple audio module playback issue

Cleanup APBridge sequence only in case of last module plugged-out.
For other modules, unregister cportid is sufficient.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mark.greer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: Add module specific driver
Vaibhav Agarwal [Tue, 29 Mar 2016 18:01:42 +0000 (23:31 +0530)]
greybus: audio: Add module specific driver

Use seperate driver to process GB Audio modules plugged-in.
It'll use helper function register_module to attach itself
to gbaudio-codec driver.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mark.greer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: Use single codec driver registration
Vaibhav Agarwal [Tue, 29 Mar 2016 18:01:41 +0000 (23:31 +0530)]
greybus: audio: Use single codec driver registration

We have single I2S port via APB1 for communication with all
audio modules. Thus, we should register single codec driver
and manage all individual audio modules internally within
this driver.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Reviewed-by: Mark Greer <mark.greer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: convert drivers to use connection->private set/get
Greg Kroah-Hartman [Tue, 22 Mar 2016 18:30:35 +0000 (14:30 -0400)]
greybus: convert drivers to use connection->private set/get

This converts all drivers to use the gb_connection_get_data() and
gb_connection_set_data() functions to make it a bit more explicit as to
what is going on.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: connection: add functions to get/set private data
Greg Kroah-Hartman [Tue, 22 Mar 2016 18:30:16 +0000 (14:30 -0400)]
greybus: connection: add functions to get/set private data

Add gb_connection_get_data() and gb_connection_set_data() to get and set
the private data of a connection, instead of "open coding" it
everywhere.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_trace: Fix broken greybus ftrace
David Lin [Sat, 19 Mar 2016 01:30:50 +0000 (18:30 -0700)]
greybus: greybus_trace: Fix broken greybus ftrace

Enabling greybus ftrace event causes null pointer access due to
that gb_message to SVC has no Bundle. Fix it by handling this in
the trace header.

Testing Done:
$ echo 1 > /d/tracing/event/greybus/enable
 [002] ...1    54.504426: gb_message_send: greybus:1-svc op=0023 if_id=0 hd_id=0 l=0
 [002] ...1    54.504461: gb_host_device_send: greybus:greybus1 if_id=0 l=8

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: audio: Use CSD instead of E2EFC for audio data connections
Mark Greer [Thu, 17 Mar 2016 17:32:37 +0000 (10:32 -0700)]
greybus: audio: Use CSD instead of E2EFC for audio data connections

There is no reason to use end-to-end flow control for Greybus
audio data connections so disable it and enable Controlled
Segment Dropping (CSD).

Testing Done: Played music using audio modules on an EVT1.5.

CC: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
CC: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera: Improve module registration mechanism
Gjorgji Rosikopulos [Mon, 14 Mar 2016 16:44:53 +0000 (18:44 +0200)]
greybus: camera: Improve module registration mechanism

Registering more then one module at same time was not
possible with previous implementation. Also unregistering
of the module was missing leading to many instability issues
when camera module is ejected when camera is still active.

Signed-off-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera: Register capabilities operation
Jacopo Mondi [Thu, 17 Mar 2016 10:02:03 +0000 (11:02 +0100)]
greybus: camera: Register capabilities operation

Register the greybus camera driver capabilities operation to the
ara_camera subdevice

Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera: Implement the capabilities operation
Laurent Pinchart [Thu, 17 Mar 2016 10:02:02 +0000 (11:02 +0100)]
greybus: camera: Implement the capabilities operation

The operation queries the camera module for its capabilities. The
debugfs interface just prints a hex dump of the binary message.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@linaro.org>
Reviewed-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: power_supply: reverse version check for new psy API
Sandeep Patil [Tue, 15 Mar 2016 19:28:38 +0000 (12:28 -0700)]
greybus: power_supply: reverse version check for new psy API

Reversing the kernel version check for new power supply APIs will
easily allow us to use older kernels with backported power supply APIs
by defining "CORE_OWNS_PSY_STRUCT" in power supply core header

Testing Done:
- Build tested with arche kernel with backported power supply APIs
- Build tested also with current arche kernel to make sure we build with
  3.10 kernels

Signed-off-by: Sandeep Patil <sspatil@google.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: loopback_test: handle SIGINT signal
Axel Haslam [Fri, 11 Mar 2016 12:19:30 +0000 (13:19 +0100)]
greybus: loopback_test: handle SIGINT signal

Adding a default timeout may not be representative of every
usecase for gb_loopback. Also, tests may continue to run
on the driver in case of a timeout.

To avoid adding a default timeout, handle SIGINT so that when the user
presses ctrl-c the test are stoped. The user can still specify a timeout
value with the -O option.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: Ensure gb->mutex is held when adding timer
Bryan O'Donoghue [Wed, 16 Mar 2016 11:29:59 +0000 (11:29 +0000)]
greybus: Ensure gb->mutex is held when adding timer

Currently in loopback on the async path we issue an operation and then add
a timer to time-out that operation should it fail to complete. Looking at a
backtrace given in its feasible op_async->pending can be true and
del_timer() can run before add_timer() has run. In the callback handler we
already hold gb->mutex. This patch fixes that potential race by ensuring we
hold gb->mutex both when we are adding and when we are removing the
relevant timer.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reported-and-tested-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: loopback: Fix broken loopback min values
Alexandre Bailon [Fri, 11 Mar 2016 16:23:37 +0000 (17:23 +0100)]
greybus: loopback: Fix broken loopback min values

Currently, when a loopback test completely fail,
loopback will return 4294967295 for every min value.
Return 0 instead of 4294967295 in such case.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_protocols: remove svc-eject timeout define
Johan Hovold [Wed, 9 Mar 2016 11:20:46 +0000 (12:20 +0100)]
greybus: greybus_protocols: remove svc-eject timeout define

The SVC eject timeout is implementation specific and does not belong in
the protocol header so move it to the svc module.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: print an error message on failed eject attempts
Johan Hovold [Wed, 9 Mar 2016 11:20:45 +0000 (12:20 +0100)]
greybus: svc: print an error message on failed eject attempts

Print an error message when the SVC fails to eject an interface.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: unexport eject helper
Johan Hovold [Wed, 9 Mar 2016 11:20:44 +0000 (12:20 +0100)]
greybus: svc: unexport eject helper

Do no export the interface-eject helper, which is only supposed to be
used by core.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: separate disabling from removal
Johan Hovold [Wed, 9 Mar 2016 11:20:43 +0000 (12:20 +0100)]
greybus: interface: separate disabling from removal

Separate interface disable from interface removal.

Disabling an interface means tearing down its control connection and
destroying (i.e. deregistering and releasing) its bundles, while
removing it means deregistering and releasing the interface itself.

This is needed to implement controlled module removal, where the module
interfaces are disabled before being physically ejected.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: rename initialisation function
Johan Hovold [Wed, 9 Mar 2016 11:20:42 +0000 (12:20 +0100)]
greybus: interface: rename initialisation function

Rename the interface-initialisation function gb_interface_enable(),
which is more descriptive.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: move interface-removal helper
Johan Hovold [Wed, 9 Mar 2016 11:20:41 +0000 (12:20 +0100)]
greybus: interface: move interface-removal helper

Move helper to remove all interfaces of a host-device to the svc code
and call it when removing the svc device as this needs to be coordinated
with flushing the SVC work queue.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: remove useless spinlock
Johan Hovold [Wed, 9 Mar 2016 11:20:40 +0000 (12:20 +0100)]
greybus: interface: remove useless spinlock

Remove useless global interface spinlock that appeared to protect the
host-device interface list, but really did not as we are doing lock-less
look-ups by relying on the single-threaded SVC workqueue.

Document the locking assumptions.

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>
8 years agogreybus: interface: disable control connection on initialisation errors
Johan Hovold [Wed, 9 Mar 2016 11:20:39 +0000 (12:20 +0100)]
greybus: interface: disable control connection on initialisation errors

Disable the control connection immediately on any errors during
interface initialisation as there's no need to keep it around for an
interface in an error state.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: always register interfaces at hotplug
Johan Hovold [Wed, 9 Mar 2016 11:20:38 +0000 (12:20 +0100)]
greybus: svc: always register interfaces at hotplug

Always register interfaces at hotplug regardless of whether
initialisation succeeded or not.

Even if a module failed to initialise we want it to have a
representation while it is physically present.

Note that the vendor and product-string attribute will read as "(null)"
for now on an interface that failed (early) initialisation.

Also note that the switch route is kept until the interface is finally
removed also on initialisation errors.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: free bundles on initialisation errors
Johan Hovold [Wed, 9 Mar 2016 11:20:37 +0000 (12:20 +0100)]
greybus: interface: free bundles on initialisation errors

Immediately free any created bundle structures on interface
initialisation errors.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: separate initialisation and registration
Johan Hovold [Wed, 9 Mar 2016 11:20:36 +0000 (12:20 +0100)]
greybus: interface: separate initialisation and registration

Separate interface initialisation from registration of the interface and
its bundles.

This is a step towards registering also interfaces that failed to
initialise (e.g. a dummy interface).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: refactor interface-route destruction
Johan Hovold [Wed, 9 Mar 2016 11:20:35 +0000 (12:20 +0100)]
greybus: svc: refactor interface-route destruction

Add interface-route-destroy helper to tear down the route and release
the interface device id.

Note that we currently need to grab a reference to the interface to
prevent it from being deallocated before tearing down the route.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: refactor interface-route creation
Johan Hovold [Wed, 9 Mar 2016 11:20:34 +0000 (12:20 +0100)]
greybus: svc: refactor interface-route creation

Add interface-route-create helper to allocate an interface device id and
setup the route.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: add comment about early control-connection disable
Johan Hovold [Wed, 9 Mar 2016 11:20:33 +0000 (12:20 +0100)]
greybus: interface: add comment about early control-connection disable

Add comment about why the control connection is disabled early when the
interface is already gone.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: remove unused drvdata helpers
Johan Hovold [Wed, 9 Mar 2016 11:20:32 +0000 (12:20 +0100)]
greybus: interface: remove unused drvdata helpers

Remove the unused interface drvdata helpers along with some dubious
comments about public and private definitions.

Greybus drivers bind to bundles and should be using the
greybus_set_drvdata and greybus_get_drvdata helpers.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: interface: remove unused function prototype
Johan Hovold [Wed, 9 Mar 2016 11:20:31 +0000 (12:20 +0100)]
greybus: interface: remove unused function prototype

Remove unused gb_interface_destroy() prototype.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: loopback: Fix broken synchonous test
Alexandre Bailon [Tue, 8 Mar 2016 16:40:16 +0000 (17:40 +0100)]
greybus: loopback: Fix broken synchonous test

loopback driver use the send_count variable to know the test progress.
The test may be stopped or change but this variable is never cleaned.
Such situation may break the next run.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: loopback: round closest the sixth decimal
Alexandre Bailon [Tue, 8 Mar 2016 15:37:37 +0000 (16:37 +0100)]
greybus: loopback: round closest the sixth decimal

The original round was removed becaused it was rounding
the integer whereas we had decimals.
Round the sixth decimal.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: loopback: Fix warning on 32-bit build
Alexandre Bailon [Tue, 8 Mar 2016 15:37:36 +0000 (16:37 +0100)]
greybus: loopback: Fix warning on 32-bit build

gb_loopback_ro_avg_attr() is using "/" to divide two 64-bit integer,
causing a reference to __aeabi_uldivmod() that is not availalbe on 32-bit.
Instead, use do_div().

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_manifest: remove unused SVC class
Johan Hovold [Wed, 9 Mar 2016 15:13:55 +0000 (16:13 +0100)]
greybus: greybus_manifest: remove unused SVC class

Mark the SVC Bundle-class id as unused.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: greybus_manifest: remove unused AP class and protocol
Johan Hovold [Tue, 8 Mar 2016 15:50:43 +0000 (16:50 +0100)]
greybus: greybus_manifest: remove unused AP class and protocol

Mark the AP Bundle-class and protocol ids as unused.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: loopback_test: Use timeout argument
Axel Haslam [Tue, 8 Mar 2016 09:03:40 +0000 (10:03 +0100)]
greybus: loopback_test: Use timeout argument

Patch "c3b0a32 Loopback_test: use poll instead of inotify"
added a optional argument for the user to specify a timeout value,
but did not use this parameter in the actual poll function. The
default of 30 seconds is always used.

Fix this by actually using the the poll_timeout parameter so the user
can run long tests.

Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Patrick Titiano <ptitiano@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: arche-platform: fix incorrect gpio variable type
David Lin [Tue, 8 Mar 2016 05:52:54 +0000 (21:52 -0800)]
greybus: arche-platform: fix incorrect gpio variable type

GPIO number obtained from of_get_named_gpio() should be signed to allow
error handling.

Testing Done:
Built & booted on EVT1.5

Signed-off-by: David Lin <dtwlin@google.com>
Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: properly annotate struct gb_control_timesync_enable_request
Greg Kroah-Hartman [Sat, 5 Mar 2016 02:40:02 +0000 (18:40 -0800)]
greybus: properly annotate struct gb_control_timesync_enable_request

A patch from created struct gb_control_timesync_enable_request,
but forgot to properly annotate that the fields are little-endian.  The
code is correct in treating them this way, so there isn't a bug, but
sparse complains.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: camera: disable E2EFC on CSI connection
Fabien Parent [Fri, 4 Mar 2016 16:32:20 +0000 (17:32 +0100)]
greybus: camera: disable E2EFC on CSI connection

Following Toshiba's recommendation we shouldn't use E2EFC on a CSI connection.
Disable E2EFC on the CSI connection.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: hd: rename CPort-features callbacks
Johan Hovold [Thu, 3 Mar 2016 12:34:40 +0000 (13:34 +0100)]
greybus: hd: rename CPort-features callbacks

Rename the CPort-features callbacks, that are not just used to enable
FCT flow, to the more descriptive cport_features_enable/disable.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: connection: add CSD connection flag
Johan Hovold [Thu, 3 Mar 2016 12:34:39 +0000 (13:34 +0100)]
greybus: connection: add CSD connection flag

Add CSD connection flag that can be specified when allocating a
connection to enable Controlled Segment Dropping in favour of E2EFC
which is enabled by default.

Note that most connections are expected to have E2EFC enabled.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: connection: generalise CPortFlags handling
Johan Hovold [Thu, 3 Mar 2016 12:34:38 +0000 (13:34 +0100)]
greybus: connection: generalise CPortFlags handling

Generalise the svc connection-create helper to accept a cport-flags
argument and handle the flags in the connection code instead.

Note that the camera driver currently manages its data connection
directly. We keep E2EFC enabled for now even though it will soon need
to be disabled due to some pending firmware updates.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: svc: clean up CPortFlags handling
Johan Hovold [Thu, 3 Mar 2016 12:34:37 +0000 (13:34 +0100)]
greybus: svc: clean up CPortFlags handling

Clean up CPortFlags handling and explicitly disable CSD when E2EFC is
enabled (CSD_n is ignored when E2EFC is set).

Note that the bootrom requires E2EFC, CSD, and CSV to all be disabled.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: connection: add connection-flag interface
Johan Hovold [Thu, 3 Mar 2016 12:34:36 +0000 (13:34 +0100)]
greybus: connection: add connection-flag interface

Add interface for associating a flag bitmask with a connection when
creating it.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
8 years agogreybus: control: Add TimeSync control commands
Bryan O'Donoghue [Wed, 2 Mar 2016 16:51:10 +0000 (16:51 +0000)]
greybus: control: Add TimeSync control commands

Simple addition of the TimeSync commands defined in the specification.
Note for the case of timesync_authoritative we're passing the request
structure directly so as not to have to pass eight parameters into the
function.

Adds:
- control.c::timesync_enable(u8 count, u64 frame_time,
                             u32 strobe_delay, u32 refclk)
  Informs an Interface to expect count TimeSync strobe pulses with
  strobe_delay milliseconds delay between each strobe. Once enabled
  an Interface may not enter a low-power mode which will result in the
  reference timer used to track time switching off.

- control.c::timesync_disable(void)
  Commands an Interface to immediately halt TimeSync logic. This will allow
  an Interface to transition into low-power modes where the reference time
  being used for TimeSync may switch off.

- control.c::timesync_authoritative(u64 *frame_time, u8 count)
  Used by the AP Module to inform an Interface of the authoritative
  TimeSync clock-master time at each strobe pulse. Down-stream clock slaves
  shall adjust their local frame-time appropriately based on the
  diseminated authoritative frame-time.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>