Ann Chen [Wed, 17 Aug 2016 08:38:56 +0000 (16:38 +0800)]
greybus: Add workqueue to handle vibrator timeout
In the beginning, module side can control the vibrator timeout value,
it can disable vibrator until timeout. But after Runtime PM control added
in, AP side didn't know when module can be suspended, the vibrator
task will be interrupted by suspending event.
Because of this problem, the module can not be in charge of counting down
the timeout value, it is now up to the AP to manage this. So add workqueue
to handle the vibrator timeout.
Jacopo Mondi [Fri, 12 Aug 2016 08:05:41 +0000 (10:05 +0200)]
greybus: camera: Remove support for legacy modules
Remove support for module implementing legacy version of camera bandwidth
requirements specifications, now that all available camera modules have
been updated to use the new version
Viresh Kumar [Thu, 11 Aug 2016 20:27:25 +0000 (13:27 -0700)]
greybus: firmware: add comment to show size calculations
The firmware file name's maximum length is set to 56 right now, but it
isn't very much readable how we got to that value (unless someone reads
that line).
Johan Hovold [Wed, 10 Aug 2016 10:58:46 +0000 (12:58 +0200)]
greybus: control: make disconnecting a core operation
Make the control-protocol disconnecting operation a "core" operation.
This is needed to be able to use the operation in the new connection
tear-down sequence of control connections, which moves disconnecting
after the flush barrier.
Johan Hovold [Wed, 10 Aug 2016 10:58:45 +0000 (12:58 +0200)]
greybus: hd: add cport_shutdown callback
Add a host-device cport_shutdown callback which will be called as part
of the new connection tear-down sequence for offloaded connection in
order to do a cport_shutdown operation on behalf of the AP.
Johan Hovold [Wed, 10 Aug 2016 10:58:43 +0000 (12:58 +0200)]
greybus: hd/es2: add cport_quiesce callback and ARPC
Add a host-device cport_quiesce callback, which will be called as part
of the new connection tear-down sequence to disable flow control after
first making sure that enough peer buffer space is available for the
next messages about to be sent.
Johan Hovold [Wed, 10 Aug 2016 10:58:42 +0000 (12:58 +0200)]
greybus: hd/es2: add cport_connected callback and ARPC
Add a host-device cport_connected callback, which will be called after a
connection has been created and that can be used by the host-device
driver to make sure its internal state is updated to match the CPort
attributes set by the SVC.
This callback will eventually replace the cport_features_enable
callback.
Kris Huang [Tue, 9 Aug 2016 03:28:37 +0000 (11:28 +0800)]
greybus: lights: enable multi color LED support
A backport (commit 79c4de08c0e5a26b04a4ac9e6543dad6379f0b40) was
applied in kernel which adding attribute-group support in led-class.
Remove the LED_HAVE_GROUPS flag check entirely that allow led
drivers to create custom attributes like color/fade_in/fade_out.
Testing Done: Compiled and verified on EVT2 and gpbridge-test module
with device class daughter board.
Georgi Dobrev [Tue, 9 Aug 2016 21:37:32 +0000 (14:37 -0700)]
greybus: greybus-driver: Add intf_oops operation
Add intf_oops operation to SVC Protocol. This
operation will notify the AP about a fatal error
in a module. The request has two arguments:
-u8 intf - the interface in question
-u8 reason - reason of the error
The response has no payload.
Upon receiving the Request, the driver disables
the Interface.
Adjust maximum segment size of the sg list to meet the maximum request
size, this will allow to have less segments which increase the
performance of data movement during transfer operations.
Test Done: using mmc_test with best-case read/write performance and see
that only one segment is used and that the results are better (288KiB vs
300KiB in read operation).
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
When enabling an interface, control device should be registered after
having successfully added the timesync. Similarly for the interface
disable path, control device should be removed first before removing
timesync.
Testing Done:
- Enable and disable the interface
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Suggested-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Vaibhav Agarwal [Fri, 5 Aug 2016 12:46:30 +0000 (18:16 +0530)]
greybus: audio: Report jack removal along with module removal
For GB module with jack slot supported, headset/headphone can still
be inserted at the time of module removal. In this case, above layer is
unaware about jack removal event which happened due to module removal.
This may lead to inconsistent state in above HAL layer. Fix this by
reporting jack removal event explicitly.
Kris Huang [Fri, 5 Aug 2016 04:59:08 +0000 (12:59 +0800)]
greybus: lights: Add runtime pm support
Modify Lights greybus driver to support runtime PM framework.
The suspend and resume function have been tested with gpbridge-test
image by sysfs. Lights functions work well on suspend/resume.
Testing Done: Compiled and verified on EVT2 and gpbridge-test module
with device class daughter board.
Jackson Chang [Fri, 5 Aug 2016 02:22:02 +0000 (10:22 +0800)]
greybus: SDIO: Add runtime pm support
Modify SDIO greybus driver to support runtime PM framework.
To enable SDIO runtime PM, it needs to remove MMC_CAP_NEEDS_POLL
and add MMC_CAP2_CORE_RUNTIME_PM in set_host_caps().
The suspend function and resume function have been tested
with micron-sdio image by sysfs. SDIO functions work well
on suspend/resume.
Testing Done: Compiled and verified on EVT2.0 + Micron ARA
SD module with USB connector
Signed-off-by: Jackson Chang <chang_jackson@projectara.com> Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:39 +0000 (15:14 +0530)]
greybus: audio: Maintain module stream state for each data connection
For SPK module, each data connection corresponds to codec DAI. Now
stream state is maintained for each DAI. So, need to maintain stream
state for each DAI/data connection for individual module as well.
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:38 +0000 (15:14 +0530)]
greybus: audio: Maintain runtime stream params for each DAI
Runtime streams are required while configuring GB module plugged-in
during active stream. Currently, it is maintained for single stream.
However, this should be maintained for a stream corresponding to each
DAI. Fix this!
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:35 +0000 (15:14 +0530)]
greybus: audio: Find data connection based on id
Currently we are using dai->name to identify data connection from list
for a module. Now since we are enabling data path based on widget,
dai->name might be invalid by the time driver receives disable request
for a widget. So, use id fetched from AIF widget->sname to identify data
connection for a module.
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:33 +0000 (15:14 +0530)]
greybus: audio: Use AIF widget to enable path between module & APB
Currently, SPK Amp switch is used to identify when to enable data path
between module and APB. With headset, other switch controls added, it is
not possible to use this switch to control data path. Instead path
should be established based on AIF widget.
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:32 +0000 (15:14 +0530)]
greybus: audio: Update parameters for gbaudio_module_update API
Earlier, module path was enabled based on module's control switch e.g.
'SPK Amp switch'. Thus widget's name was sufficient to parse and
identify the direction. Now individual modules' path will be enabled
based on AIF widget status. So, it is required to get complete widget
details, say w->type is used to identify direction (playback/capture)
and w->sname is used to identify module's DATA connection used for
communication via greybus.
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:31 +0000 (15:14 +0530)]
greybus: audio: Update dai_driver table with appropriate fields
Currently, the stream name for the DAI driver is generically set to "GB
Audio Playback" and "GB Audio Capture". This is OK since we use a single
interface on APB1 but that could change in the future. Update the DAI
driver table entries to properly reflect the interface used.
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:30 +0000 (15:14 +0530)]
greybus: audio: Split helper APIs based on stream direction
Now, module is enabled/disabled based on widget event only and not
during startup/shutdown callbacks. Thus, we needn't compare codec_state
in enable/disable module helper APIs. Also, these can be further
simplified based on stream direction.
Vaibhav Agarwal [Thu, 4 Aug 2016 09:44:29 +0000 (15:14 +0530)]
greybus: audio: Enable audio path based on control switch state only
As per current implementation, audio data is played from each individual
SPK module connected to endo frame. This is not a valid requirement in
case of capture/headset path. So, provide a mechanism to enable
individual module path based on it's control switch state.
For most of the helper functions, goto statement is widely used. It was
originally used with an intent of single exit point for the function
with some cleanup required. This is no more the case. So, simplify code
by avoiding un-necessary gotos.
greybus: arche-platform: Add support for SPI bus sharing for Mihi
In case of Mihi, SPI bus is shared between APB1 and APB2
SPI ROMs, so their FW flashing must be sequential and
arche-platform driver should make sure that they are mutual
exclusive in nature.
So this patch adds certain restrictions to the user of the
arche-platform driver,
- User can no longer flash APB1 and APB2 SPI ROM in parallel
- SPI bus becomes an resource, so user must claim it by moving
respective APB device into FW_FLASHING mode and release it
by exiting FW_FLASHING mode. User can exit FW_FLASHING mode by
switching to any other modes (ACTIVE, OFF, STANDBY).
- If APB1 is in FW_FLASHING mode, APB2 can no longer enter into
FW_FLASHING mode. User will get -EBUSY.
Having said that, while APB1 is into FW_FLASHING mode,
APB2 can independently boot from its own SPI ROM.
Testing Done: Tested by simulating usecase on EVT2.
- Made sure that APB1 and APB2 FW_FLASHING mode is mutual exclusive
in nature. Confirmed that an attempt on second device return -EBUSY.
- Added simulating code, where printed state of dummy gpio for
spi-en and verified that it shows right pin status for both APBs
greybus: arche-platform: Reset SVC & APB only if turned off by SUSPEND_PREPARE
There is possible race condition in arche platform driver for
maintaining of ->state field, when shared with timesync driver.
Assume device booted fine, all connected modules have been enumerated
correctly. As part of suspend-resume operation we have pm_notifier
callback, where we turn off SVC & APB and coldboot on resume.
In the process of resume, all modules gets enumerated again, and
timesync driver does come into picture everytime.
So when timesync driver requests arche-platform to change the state
to TIMESYNC and in the middle of sync operation, if suspend gets
triggered, then execution lands into arche-platform->pm_notifier callback,
leading to race condition in the driver, where it checks for (state != ACTIVE)
in PM_SUSPEND_PREPARE and returns, but in PM_POST_SUSPEND it just simply
coldboots SVC & APB, which would inbalance all resources (including IRQ).
So we need a add check in PM_POST_SUSPEND, to make sure that, we only
coldboot devices if they are in to off state,
i.e. if (state != OFF) then return.
Testing Done: Done regressive suspend/resume testing on EVT2 platform.
Note that, I some time hit issue.
Johan Hovold [Wed, 3 Aug 2016 12:09:34 +0000 (14:09 +0200)]
greybus: es2: add define for ARPC CPort requests
Add dedicated define for ARPC CPort requests instead of using the
default timeout for USB vendor requests.
We still allow responses to take 500 ms to arrive, but note that this
adds on top of the 500ms already allowed for a requests to be
acknowledged. This should probably be tightened up at some point.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The 'GB_AUDIO_TYPE_GET_TX_DELAY' and 'GB_AUDIO_TYPE_GET_RX_DELAY'
are no longer a part of the Greybus Audio Device Class Protocol
so remove support for them. The message numbers are not coalesced
to prevent compatibility issues between the AP and the module.
Testing Done: Played music using a speaker module
Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The 'AUDIO_APBRIDGEA_TYPE_GET_TX_DELAY' and
'AUDIO_APBRIDGEA_TYPE_GET_RX_DELAY' message types have been
removed from the AP <-> APBrigdeA Audio Protocol so remove
them from the code. Do not coalesce the message type numbers
to prevent compatibility issues between the AP and APBridgeA.
Testing Done: Played music using a speaker module
Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
greybus: timesync: Printout strobe count on sync failure
If we failed to synchronize the FrameTime it would be useful to know how
many of the expected strobes arrived, for example a value of 0/5 would
indicate the SVC was completely dead but a value of 4/5 would indicate one
GPIO pulse got lost i.e. the AP was too slow reacting to an interrupt and
completely missed one of the strobe events. In either case the actual
number of strobes is a useful thing to print out.
The guard for initiating a new synchronization operation should allow for
that resync to happen in every single state except for INVALID. This patch
fixes by ensuring the guard does just that. With local testing it was
possible to break a sync to a Module. This hasn't been observed in a buglog
but should be fixed anyway.
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Acked-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
It's possible the AP could miss an incoming SVC timesync pulse i.e. the AP
could have interrupts switched off for long enough that one SVC GPIO strobe
ends up over-lapping another one. TimeSync should be able to deal with this
type of transitory failure by retrying a failed synchronous TimeSync resync
up to 'n' number of times. For this patch 'n' has been set to five, which
is a hand-wavy choice that 'feels' right.
David Lin [Tue, 2 Aug 2016 22:34:46 +0000 (15:34 -0700)]
greybus: interface: delete control device upon enable failure
There is an issue that when an interface failed to be enabled due to
timesync failure, a previously added control device is not deleted as
part of the error clean-up. This causes a leak in the sysfs file when
the interface is disabled. This would eventually cause this particular
interface to be unable to register future control device even after
unipro_reset. See failure logs below:
Johan Hovold [Wed, 27 Jul 2016 14:37:22 +0000 (16:37 +0200)]
greybus: es2: fix arpc active-list corruption
Fix ARPC active-list corruption due to incorrect list-interface usage.
The corruption manifested itself as ARPC timeouts due to expected
responses not being recognised whenever more than one ARPC was active.
This could be seen for example when two interfaces were being runtime
suspended in parallel:
[ 165.739896] usb 1-1.1: invalid arpc response id received: 13
[ 165.794743] greybus 1-5.5: gb_interface_refclk_set - 0
[ 166.241202] usb 1-1.1: failed to execute ARPC: -110
Fortunately the impact of this bug has so far been limited to such
timeouts and error messages due to ARPC currently only being used for
CPort reset in the connection tear-down path.
Reported-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The wrong pointer was checked for allocation failures when allocating
the ARPC response buffer, something which would lead to allocation
failures going undetected.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
David Lin [Mon, 25 Jul 2016 23:29:20 +0000 (16:29 -0700)]
greybus: audio: add runtime pm to enumerated control and DAPM widget
There's an issue that the userspace is not able to control both the
enumerated control and DAPM widget when audio bundle is in the SUSPEND
state. This patch fixes the issue by adding pm_runtime_get/put() calls
for the both controls.
Testing Done:
- Use tinymix to get and put both enumerated control and DAPM widget as
the followings, and observe audio bundle is able to wake up from
suspend.
David Lin [Tue, 26 Jul 2016 23:27:28 +0000 (16:27 -0700)]
greybus: svc_watchdog: Add sysfs file to change the behavior of bite
Currently, AP performs unipro_reset if SVC fails to response to its
ping. While this error recovery is best suited for the end-user
experience, errors in the UniPro network could potentially go unnoticed
by the QA and fishfooders in the development phase of the project. This
patch adds an option to trigger a kernel panic so logs can be collected
for analysis.
Testing Done:
- Reproduce issue and observe kernel panic when
watchdob_control is changed to 'panic'
Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
greybus: firmware: Update Documentation and sample application
Update documentation and sample application to capture the 'status' byte
in backend version operation and new error types in backend firmware
update operation.
greybus: firmware: Add 'status' byte to backend fw version response
The backend processor may not be ready to return the version of firmware
it is running by the time AP requests for it. The greybus specification
is updated to return 1-byte 'status' to return the error type, RETRY is
one of them.
This patch implements that in greybus now.
Note that the version structure was common across interface and backend
version requests earlier, but that is changing as well.
greybus: interface: Add quirk for no PM for S2 Loader
S2 Loader doesn't support runtime PM operations currently and we will
fail to suspend/resume the bundle for firmware management protocols.
Once that happens, the bundle and its connections will be pretty much
useless as we would have tried to disable/enable all connections during
such an operation and the S2 loader doesn't expect the connections to go
away during normal operation (except in the case of mode-switch).
This patch defines a new quirk GB_INTERFACE_QUIRK_NO_PM and uses a new
interface init status value (GB_INIT_S2_LOADER_INITIALIZED) which will
be advertised by S2 Loader now in the init status.
After detecting the currently running stage as S2 Loader, the kernel
wouldn't attempt suspending or resuming the bundle.
Reviewed-by: David Lin <dtwlin@google.com> 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>
greybus: interface: Rename *_NO_PM as *_NO_BUNDLE_ACTIVATE
Its a special quirk just for the bootrom as it doesn't have any PM
operations implemented. As the greybus bootrom bundle driver doesn't try
to do any PM stuff, this quirk is used only to skip bundle activate
operation currently.
Rename the GB_INTERFACE_QUIRK_NO_PM quirk to
GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE to suit its purpose better as the
GB_INTERFACE_QUIRK_NO_PM will be used for other quirk now.
This patch implements runtime PM support for firmware management bundle.
This guarantees that the bundle will be active, while the AP or the
Module is trying to exchange any operations over any of the CPorts.
- Firmware Management CPort:
Runtime PM get/put calls are placed around the ioctl calls, which are
all implemented as blocking ioctls.
- Component Authentication CPort:
Runtime PM get/put calls are placed around the ioctl calls, which are
all implemented as blocking ioctls.
- SPI:
Uses the interface provided by spilib.c and runtime PM get/put are
called around connection usage.
- firmware-download:
This is the most tricky one. All operations on this CPort are
initiated from the Module and not from the AP. And the AP needs to do
runtime_pm_get() before any request is received over this CPort.
The module doesn't send any request over this connection, unless the
AP has requested the module over firmware management CPort to download
a firmware package over firmware download CPort.
And so the runtime PM get/put calls around the ioctls in
fw-management.c are sufficient to handle the firmware management CPort
as well.
The response-received tracepoint is currently broken. Instead of parsing
the received message header it was tracing a bunch of zeroed fields from
an uninitialised response buffer.
Fix this by moving the tracepoint after were the response buffer is
initialised.
The operation type included in the error message printed for malformed
responses has never been correct. An uninitialised buffer was used to
retrieve the type, resulting in the type always being reported as 0.
Fix this by passing a properly aligned header to the response handler,
and drop the now redundant id and result parameters.
Fixes: cb0ef0c019ab ("operation: print message type on errors") Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Philip Yang [Fri, 22 Jul 2016 21:48:14 +0000 (05:48 +0800)]
greybus: HID: Add runtime pm support
Modify HID greybus driver to support runtime PM framework.
The suspend and resume fucntion have been test with tutorial-hid,
e-ink-display and gpbridge-test image by sysfs resume, all HID
buttons work well on suspend/resume.
Testing Done: Compiled and verified on EVT2, DB3.5, GPB test module
with daughter board, Red module.
Signed-off-by: Philip Yang <yang_philip@projectara.com> Reviewed-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
greybus: bootrom: Rename download_firmware() as find_firmware()
The download_firmware() function isn't downloading the firmware but just
finding if one is available or not. The same applies to the error
message printed by it.
Replace 'download' with 'find' to make it sound better.
greybus: bootrom: Set timeout before sending AP_READY
A special race is observed in the case where the phone boots with
modules attached to it.
In that case, the AP processes a later FIRMWARE_SIZE request from the
bootrom, before processing the response to the earlier AP_READY request.
And because of that, we set the timeout from gb_bootrom_probe() after
trying to cancel it from gb_bootrom_firmware_size_request().
And with that, if the firmware package isn't available for the kernel to
directly read from, then we get a timeout print message like below:
[ 23.669764] bootrom 1-3.3.1: Firmware file 'ara_00000126_00001001_fffe0001_ffe5001a_s2l.tftf' requested
[ 24.680528] bootrom 1-3.3.1: Timed out waiting for Firmware Size Request from the Module
Note that this doesn't happen if the module is inserted into the frame,
after the phone is already booted.
This behavior is the result of an earlier commit cdd1cb3f4943
("operation: add completion work queue").
This perhaps happens only at boot time because the UNBOUND wq
(connection->wq) gets a chance to run on other CPUs, while the BOUND wq
(gb_operation_completion_wq) doesn't at that stage (24 seconds since
boot).
Setting the timeout before sending the AP_READY request fixes it for
now.
Reported-by: Johan Hovold <johan@hovoldconsulting.com> 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>
greybus: bootrom: Skip setting timeout in failure path of size request
The currently set value of next_request_type in the error path of
gb_bootrom_firmware_size_request() is not correct, as it should have
been NEXT_REQ_FIRMWARE_SIZE for the failure case (as we should be
waiting for another similar request).
But, if an error occurs in gb_bootrom_firmware_size_request(), then the
ES3 bootrom will never be able to recover from it and send another
request. And so there is no point waiting for another request and timing
out.
greybus: control: Print bundle-id in print messages
The new power management specific operations added to the control
protocol do not print the bundle-id in the error messages and it is not
possible to identify which bundle-id the operation failed for.
Fix that and do minor rewriting of the print messages to make them more
readable.
David Lin [Fri, 22 Jul 2016 20:46:25 +0000 (13:46 -0700)]
greybus: operation: print id when synchronous operation timeout
In case of a synchronous operation timeout error, it's helpful for
purpose of debugging to print the operation id in the error message, so
that we know if the response is received at a later time after operation
time out.
Testing Done:
- Observe the error message below when response comes later after
operation timeout:
[ 792.973978] greybus greybus1: 0/0:0: synchronous operation id 0x0005
of type 0x21 failed: -110
[ 800.646694] greybus greybus1: 0/0:0: unexpected response id 0x0005
received
Signed-off-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
It is suggested to avoid using ARA keyword externally. So we need to
update GB codec driver. Also, codec name is currently set to 'gb-codec'.
However, it makes more sense to name it as apb-dummy-codec, since it is
used to control various audio modules connected to APB via greybus.
spilib is used by multiple users currently (spi.c and fw-core.c) but
commit aa52b62a0556 broke that hierarchy and introduced gbphy dependent
code in spilib.
This may have unreliable consequences as we are doing following
operation unconditionally now:
which may not go well when the parent is of type &bundle->dev
(fw-core.c).
This patch introduces spilib_ops and lets the users of the core register
them. This shall have no functional change for the spi.c usecase and
shall fix the unreliable results for the fw-core.c usecase.
Tested by writing to mtd0 dev and verifying (with print messages) that
the below routines are getting called for a gpbridge-test module.
David Lin [Thu, 21 Jul 2016 00:18:39 +0000 (17:18 -0700)]
greybus: timesync: do not print frametime by default
Currently frametime are being printed whenever an Interface is
runtime-resumed. This is unnecessarily chatty. This patch moves the
frametime print from using pr_info() to dev_dbg().
greybus: pm: add error handling to bundle activation
The firmware now keeps the underlying hardware disabled until
receiving the first Bundle Activate request. Additionally: requesting
transition to a state the bundle is already in is no longer an error.
We can now add proper error handling to the bundle activate call.
Johan Hovold [Thu, 21 Jul 2016 12:24:11 +0000 (14:24 +0200)]
greybus: control: suppress bundle_activate() for bootrom
We always knew backward compatibility with the ES3 bootrom, which was
finalised about a year ago, would be a pain. Here we go again.
The bootrom does not support control requests added after it was burnt
into ROM for obvious reasons. This means that we need to suppress
sending the new bundle_activate() operation to any interface executing
the legacy bootrom.
Do so by adding a new NO_PM interface quirk (we can use the
control-protocol version for this later once we bump it).
Note that the interface-disable path (e.g. for power down) is already
handled by the FORCED_DISABLE quirk, and that the suspend/resume
paths are currently avoided by making sure that the bootrom bundle
never suspends.
Replace prefix "ara_" with prefix "gmp_" for TFTF firmware filenames.
Testing Done: compiled and flashed EVT2 (bootimage) and tested that
"gmp_" prefixed tftf files are expected. Pushed one from
FDK and checked that it's properly loaded.
greybus: timesync: probe shouldn't complete until FrameTime sync does
Currently the probe() function contains the asynchronous() variant of
FrameTime synchronization. This patch converts to the synchronous() version
of synchronization. This is required for two reasons first a probe() cannot
reasonably be considered to be complete without successfully completing a
time synchronization for Interfaces that care about that sync. Secondly
scheduling the operation asynchronously means its possible the PM-runtime
suspend() path can execute before the async timesync operation completes.
For both reasons we want to run synchronization - synchronously.
Ryan Lim [Wed, 20 Jul 2016 15:14:02 +0000 (08:14 -0700)]
greybus: loopback_test: Cancel only the tests running on selected devices
When starting a loopback test, it cancels all currently running tests on
all loopback devices. When -m argument is given, which runs the test on
specific loopback devices, only the tests running on the selected
devices need to be cancelled before starting new tests.
Signed-off-by: Ryan Lim <limryan@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Currently we have a long initial delay when initiating the first operation
to synchronize the FrameTime. That made sense during development of the
feature since we did synchronization asynchronously and wanted to give some
grace time for new Interfaces to be added before initiating a new
synchronization. On the PM runtime resume path though we do a synchronous
restoration of FrameTime and in this case waiting for 1 second before
initiating the first operation is clearly wrong.
This patch reduces the initial operation time bringing the synchronous call
time down by 990 milliseconds.
Johan Hovold [Wed, 20 Jul 2016 14:40:27 +0000 (16:40 +0200)]
greybus: interface: hibernate UniPro link in activation error path
To be well-behaved, we should hibernate the link before disabling UniPro
in case the link has already been established (i.e. when the interface
type has been detected as UniPro or Greybus).
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Johan Hovold [Wed, 20 Jul 2016 14:40:26 +0000 (16:40 +0200)]
greybus: interface: fix power_state documentation
Reword the power_state attribute documentation to make it clear that an
attempt to boot and possibly enumerate an interface is made when writing
"on" to the file, and that on errors the interface will again be powered
down.
Drop the incorrect claim that writing the currently read value has no
effect, since no such guarantees can be made (e.g. several writers may
be sleeping on the interface mutex).
Also fix some minor language issues.
Reviewed-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
User space needs the capability of powering ON or OFF an Interface for
multiple use cases. For example, userspace may want an Interface
currently in its S3 boot stage, to boot into its S2 Loader stage to
update the bridge SPI flash. Or the Interface is running its S2 Loader
stage and updated the SPI flash with the new S2 Loader firmware and
wants to boot into the new S2 Loader firmware.
Another use case can be, Android wants to disable (not eject) a
misbehaving module.
Add a 'power_state' sysfs file within the interface directory. It can be
read to know the current power state of the Interface and can be written
to power ON or power OFF an Interface. Possible values that can be
written or read from it are: "on" and "off".
Testing Done: Tested by enabling/disabling camera module on EVT 2.0.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> CC: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
[johan: drop es3-quirk duplication, add to power attribute group, fix
return value, drop tags ] Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>