In the 4.7-rc1 kernel release, PWMF_ENABLED is removed and
pwm_is_enabled() is the correct way to test if a pwm device is enabled,
so provide a version of that function that will work on all older
kernels and change the pwm.c driver to use it so that it will work on
newer kernels as well.
Tested:
Tree now builds successfully against 3.14.y, 4.4.y, 4.5.y,
4.6.y, and 4.7-rc2 kernels
Vaibhav Agarwal [Wed, 8 Jun 2016 15:03:26 +0000 (20:33 +0530)]
greybus: audio: Ratelimit err messages
In case of audio mgmt connection failure, GB requests would fail giving
an error message within the driver and reporting error. However there is
no error handling in above HAL and it'll keep on triggering similar
request via GB codec driver. This may overflood serial console. In one
of the instance it locked CPU for >10sec and caused a watchdog bite.
Thus ratelimit those error messages.
Jeffrey Carlyle [Tue, 7 Jun 2016 15:22:22 +0000 (08:22 -0700)]
greybus: svc: implement connection_quiescing call
Implement Greybus remote call to connection_quiescing operation. This
operation disables flow contorl for the connection and resets associated
attributes.
Testing done: tested along with required NuttX firmware changes, booted
EVT2, inserted module, removed module, inserted module. Verified module
was functioning as expected.
greybus: timesync: Add debugfs entry to display frame-ping in ktime
This patch makes a debugfs entry in
/sys/kernel/debug/greybus/X-svc/frame-ktime that generates a TimeSync ping
event to the system and then subsequently presents that data to user-space
as a ktime/timespec clock-monotonic value rather than as a raw frame-time,
to aid humans in debugging and understanding frame-time and to provide an
example of the converting a frame-time to timespec/ktime to other
developers.
This patch adds gb_timesync_to_timespec_by_svc() and
gb_timesync_to_timespec_by_interface() respectively. These routines will
convert from a given FrameTime to a ktime/timespec within an envelope of
about 17 seconds. The purpose of this routine is to enable reporting of a
FrameTime from a Module such as a Camera Module and to allow the AP to
then convert this timestamp into a Linux-native timestamp such as ktime.
This is useful and required in the v4l layer.
At 19.2MHz the accuracy of this conversion is about .3 femtoseconds per
count, which means at a 1 second offset from the reference the cumulative
error is about 1.59 nanoseconds. 1.59 nanoseconds is still less than 1
clock's worth of error @ 19.2MHz where each clock is 52.0833~ nanoseconds.
We're aiming for a maximum error rate of 30 nanoseconds which means at the
clock rate we are running at, the conversion from a FrameTime to a Linux
ktime/timespec can be plus-or-minus about 17 seconds from the reference
FrameTime/ktime pair before the routine will refuse to convert.
A realistic use-case for this routine is envisaged to be
- Greybus message received
- Some processing takes place - taking milliseconds
- Call into this routine is made
- Actual time between event in Module and conversion in AP < 1 second
- Error rate in conversion at 1.59 nanoseconds is less than 1 clock
@ 19.2MHz
This routine is not designed to allow for conversions for events with
large gaps between the event time and the current reference time for
conversion. Since FrameTime can be a very large integer we cannot convert
an arbitrarily large FrameTime to ktime, the feeling and objective here is
to make an over-provisioned envelope that in practical terms can never be
exceeded by expected use-cases. To convert longer gaps more work would have
to be done but ultimately some limit needs to be imposed and right now 0.3
femotseconds per clock on MSM8994 is both accurate and generous.
Adds:
- timesync.c::gb_timesync_frame_time_to_timespec_by_svc(
struct gb_svc *,
u64 frame_time,
struct timespec *ts)
- gb_svc is a pointer to a standard greybus SVC data structure
- frame_time is a system FrameTime.
- ts is an output parameter which represents the converted FrameTime
as a CLOCK_MONOTONIC timespec value.
- Returns 0 on success or a negative number indicating the type of
error on failure.
- timesync.c::gb_timesync_frame_time_to_timespec_by_interface(
struct gb_interface *,
u64 frame_time,
struct timespec *ts)
- gb_svc is a pointer to a standard greybus Interface data structure
- frame_time is a system FrameTime.
- ts is an output parameter which represents the converted FrameTime
as a CLOCK_MONOTONIC timespec value.
- Returns 0 on success or a negative number indicating the type of
error on failure.
greybus: tracepoints: Add standard Linux tracepoint for TimeSync event
This patch adds a tracepoint to the TimeSync ISR, the purpose of which is
to indicate a TimeSync event has happened. This tracepoint can be enabled
by issuing the following command:
TimeSync needs to bind into Greybus in a few places.
- core.c
To initialize its internal state and tear-down its internal state.
To schedule a timesync to a newly added Bundle after probe() completes.
- svc.c
To get access to the SVC and enable/disable timesync as well as
extracting the authoritative time from the SVC to subsequently
disseminate to other entities in the system.
- interface.c
To get access to an Interface in order to inform APBx of timesync
enable/disable and authoritative operations.
0. arche-platform.c/arche-apb-ctrl.c
Modifies the platform layer to hook the incoming TIME_SYNC signal up to
the timesync strobe IRQ handler. If the arche-platform driver can't
satisfy the request for the wake-detect line, it will return -EAGAIN and
the calling work-queue must reschedule the attempt to get exclusive
access to the wake-detect pin logic. A private data field is added to
the arche-platform driver to enable passing of a timesync pointer to the
ISR responsible for synchronizing time.
1. timesync.c
A new file added which contains all of the logic associated with sending
greybus commands to SVC, APBx or Interfaces to enable, disable and
disseminate timing information.
2. timesync_platform.c
Any platform/arch specific code goes into timesync_platform.c.
Originally the idea was to keep the x86 and ARM arch dependencies in a
timesync_platform_arch.c file - however with further refinement that's
currently not necessary however just-in-case it becomes necessary to
resuscitate arch or platform specific methods for accessing timer
resources that access shouldn't be part of the core timesync.c logic and
so for the moment we access these timer resources through a thin access
layer in timesync_platform.c. Expect this to go away long term ideally.
Vaibhav Agarwal [Fri, 3 Jun 2016 12:15:30 +0000 (17:45 +0530)]
greybus: audio: Report DISCONNECT event after resource cleanup.
Reporting DISCONNECT event immediately on module removal causes
race condition while re-populating mixer controls by above HAL. The
original intent was to avoid any (invalid) mixer control modification
request from above layer.
Ideally, it should report 'MODULE_NOT_READY' on module plug-out and
DISCONNECT after resource cleanup. This would involve changes in GB
Audio manager and HAL layer.
Since we already have a plan to remove GB Audio manager, I'm making this
change in GB codec driver to avoid any race condition. Also, codec
driver already ensures mixer control modifcations for disconnected
modules are not triggered to AP Bridge audio FW & reported invalid.
Alex Elder [Fri, 3 Jun 2016 20:55:39 +0000 (15:55 -0500)]
greybus: tracing: fix message traces
The original message trace events were defined long before the
recent tracing updates. It records information that's not
really directly related to a message. Change the information
recorded and reported for message events to just be the content
of the message header.
Alex Elder [Fri, 3 Jun 2016 20:55:38 +0000 (15:55 -0500)]
greybus: tracing: add timing traces
Bryan reports he used certain message traces to determine when time
sync messages transit the boundary between the Greybus core and the
host device. This patch adds two trace events--one a message event
for outbound messages (because it indicates its operation and its
destination), and one host device event for incoming messages
(because message information isn't available as early as desired).
These events are being created to allow the same sort of analysis
of messages without having to store extra information for every
message trace. (The next patch changes the information a message
trace records.)
Alex Elder [Fri, 3 Jun 2016 20:55:37 +0000 (15:55 -0500)]
greybus: tracing: define connection traces
Define a new gb_connection trace point event class, used to trace
events associated with the connection abstraction. Define four basic
trace events for this--creation, drop of last reference, and when
adding or dropping any other reference. There are certainly
more events that we might want to add, but aim is to just get the
basic framework in place.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 3 Jun 2016 20:55:36 +0000 (15:55 -0500)]
greybus: tracing: define bundle traces
Define a new gb_bundle trace point event class, used to trace events
associated with the bundle abstraction. Define four basic trace
points for this--creation time, drop of last reference, before
adding it to its interface and when removed when its interface
is destroyed.
Alex Elder [Fri, 3 Jun 2016 20:55:34 +0000 (15:55 -0500)]
greybus: tracing: assign "parent" id first
Most abstractions to be traced will have a sort of "parent" object
it is associated with, and an identifier for that parent is stored
with the as trace event data. For example, the parent of a message
is the operation it's a part of, and the parent of an operation is
the connection it uses.
We'll arrange to define that parent id first in all events. Most
abstractions already do this. Move an interface's module id so it's
defined and assigned first. The message traces are going to be
changed soon, so leave that one alone.
Alex Elder [Fri, 3 Jun 2016 20:55:33 +0000 (15:55 -0500)]
greybus: tracing: fix module num_interfaces
A module's num_interfaces field is included in the data to be
recorded for tracing, but it's never assigned or reported. Fix
its type to be size_t, to match its definition in the gb_module
structure.
Also correct a format length modifier used for a host device's
num_cports field.
Alex Elder [Fri, 3 Jun 2016 20:55:32 +0000 (15:55 -0500)]
greybus: tracing: reorder trace definitions
Move the definition of the module trace events below those for the
interface. We'll define them in an order that represents a sort of
layering of the abstractions (note not all of these are defined yet):
message
operation
connection
bundle
interface
module
host device
Other tracepoints (like perhaps some tied to timesync) will go at the
beginning or end.
Alex Elder [Fri, 3 Jun 2016 20:55:31 +0000 (15:55 -0500)]
greybus: tracing: fix host device num_cports
The type of the gb_host_device num_cports field is size_t. Correct
the num_cports data recorded with a host device event so its type
matches that; fix the format length modifier used for it as well.
Alex Elder [Fri, 3 Jun 2016 20:55:30 +0000 (15:55 -0500)]
greybus: define BUNDLE_ID_NONE
Define a bundle ID that means "no bundle". This will be used for
tracing connection events during the portion of a connection's
lifetime when it has no bundle associated with it. Don't allow
any bundle to be created using that ID.
Alex Elder [Fri, 3 Jun 2016 20:55:29 +0000 (15:55 -0500)]
greybus: tracing: fix "make check" warnings
Some of the trace buffer fields were defined as Booleans. This
leads to two problems reported by "make check":
- the __field() macro (or some descendent macro) performs
a sizeof(bool) operation, which results in a warning
- The TP_printk() macro, which specifies a printf() style
format string, produces a warning when one attempts to
format a Boolean as an integer.
Fix both problems implicitly converting Boolean values from the data
structures into integers in the trace buffer.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Evgeniy Borisov [Tue, 31 May 2016 08:33:11 +0000 (11:33 +0300)]
greybus: camera-gb: Implement camera module reference counting as subject.
In explanation:
The main idea for implementing reference counting is to not block exit
until any other modules are in use. Camera responsibility is to handle
properly any additional calls after camera exit and that what this
patch is doing:
1. Free camera module when reference count is zero.
2. After camera cleanup handle properly any additional ongoing
transaction. Return error if connection is destroyed.
Viresh Kumar [Mon, 30 May 2016 07:35:09 +0000 (13:05 +0530)]
greybus: control: Mode-switch is a 'core' operation
The operation layer allows only the 'core' operations on a connection,
which is in its 'disconnecting' state.
Mode switch is sent at the very end of interface-disable sequence, and
the control connection is already in its 'disconnecting' state at that
time. And so gb_operation_get_active() always fail with error -ENOTCONN.
The operation core already has support for such 'core' operations, just
that we were missing the needed flag while creating the mode switch
operation.
Axel Haslam [Tue, 31 May 2016 12:36:13 +0000 (14:36 +0200)]
greybus: uart: wait for credits on shutdown
We should try to wait until all credits are accounted
for before returning from shutdown.
For this purpose add a helper function that will
wait on completion, and call it form the shutdown.
This helper will also be useful when "wait until sent" is
implemented.
Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Axel Haslam [Tue, 31 May 2016 12:36:11 +0000 (14:36 +0200)]
greybus: uart: Add credits based tracking for transmit path
To avoid polling the firmware for space, a credit based system
is implemented.
The host will keep track of how many credits (bytes) it has
sent to the firmware, and stop sending data when the quota
is filled.
The host will be informed that the firmware has more
room for data when it handles the receive_credits request
message from the firmware, and will continue to write data
as credits become available.
The firmware and the host may implement an algorithm to aggregate
credits, and avoid extra greybus traffic.
Suggested-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Axel Haslam [Tue, 31 May 2016 12:36:10 +0000 (14:36 +0200)]
greybus: uart: Use a fifo to send data to the modules
The firmware now buffers data instead of blocking while the transfer
is sent, and the write operation cannot sleep.
Instead of using gb_transfer_sync (which sleeps) in the write callback,
buffer data in a fifo and send it from from a work queue.
The write_room callback will will report 1 byte less that what is really
available in the fifo, to leave space for extra characters that may
be added by the tty layer.
Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Axel Haslam [Tue, 31 May 2016 12:36:08 +0000 (14:36 +0200)]
greybus: uart: Handle CRTSCTS flag in termios
Handle the CRTSCTS flag in set_termios, so that auto
flow control can be turned off. For this, add a new flag
in the line coding request specifically for this purpose.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Add a generic interface for bundle drivers to use to request that a
mode switch is carried out on its behalf.
Mode switching involves tearing down all connections to an interface,
sending a unidirectional mode-switch request, and waiting for a mailbox
event that triggers deferred control connection reset and re-enumeration
of the interface. In case of a timeout waiting for the interface mailbox
event, or on other errors, the interface is powered off.
All of this needs to be done by core from work-queue context in order
not to block incoming SVC requests and bundle-device tear down. Care
must also be taken to serialise against concurrent module removal events
and eject requests.
Special handling of legacy mode-switching is also added in order to
continue to support the ES3 bootrom.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Add a new host-device callback to flush any host-device queues,
including any ongoing transfers, as part of connection tear down.
The host-device buffers are flushed after the disconnecting operation
have completed and the AP queues have been emptied.
This can be used to flush already queued messages which upon reception
would have been discarded by the remote end anyway.
Note that this does not remove the need to flush any host-device queues
as part of CPort disable which needs to make the CPort ready for reuse
after deallocating all associated state and resetting the port.
Implement proper connection closure, which includes sending ping
requests on the connection being tore down while coordinating with the
remote interface as well as the SVC.
This specifically implements the new ping operation, which in case of
offloaded connections is handled by the host-device driver in an
implementation-defined manner through a new callback.
Note that the normal connection tear-down procedure is executed in case
of failed connection establishment due to failed connected operation.
Specifically, the disconnecting request is sent also in case the
connected operation never succeeded. This is needed since the interface
may have enabled FCT flow upon receiving the connected request.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Johan Hovold [Fri, 27 May 2016 15:26:33 +0000 (17:26 +0200)]
greybus: operation: clean up early connection-state check
Now that the legacy invalid state is gone, clean up the early
connection-state check in the receive path and explicitly drop incoming
messages for disabled connection.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Johan Hovold [Fri, 27 May 2016 15:26:31 +0000 (17:26 +0200)]
greybus: connection: move CPort Buffer configuration out of svc helpers
The CPort Buffer configuration in the host-device needs to match the
CPort feature flags set by the SVC, but they need not always be
configured at the same point in time.
This will be used when implementing proper connection tear down.
Johan Hovold [Fri, 27 May 2016 15:26:24 +0000 (17:26 +0200)]
greybus: interface: avoid I/O to bootrom during removal
Add an interface quirk flag to suppress I/O during interface disable.
This is needed to prevent I/O to the bootrom during controlled
connection tear down (e.g. eject or driver unbind). This will be more
obvious with the new connection tear-down procedure.
Johan Hovold [Fri, 27 May 2016 15:26:22 +0000 (17:26 +0200)]
greybus: core: avoid I/O to disconnected interfaces
Add new helper to disable connections to interfaces that have already
been disconnected (e.g. forcibly removed).
The connection tear-down procedure differs enough depending on whether
the interface is still present or already gone to warrant a dedicated
helper. This will become more obvious with the new tear-down procedure,
which involves I/O on the connection being tore down.
This also simplifies handling of the legacy bootrom, which does not
support the new tear-down operations.
Specifically, this allows us to remove the early control-connection
tear down during interface disable, and also avoids some error messages
currently printed during legacy mode switch (i.e. bootrom
boot-over-UniPro) and forcible removal.
Alex Elder [Tue, 24 May 2016 18:34:52 +0000 (13:34 -0500)]
greybus: drop a bogus semicolon
Coccinelle reports that gb_svc_pwrmon_debugfs_init() has a block of
a for loop which is followed by an unnecessary semicolon. Get rid
of that semicolon.
Alex Elder [Tue, 24 May 2016 18:34:51 +0000 (13:34 -0500)]
greybus: use PTR_ERR_OR_ZERO()
Coccinelle points out that the macro PTR_ERR_OR_ZERO() handles the
frequent case of converting a pointer into either error code (if its
value is an encoded error value) or 0 (otherwise). Switch some code
in gb_power_supply_register() to use that macro. I have verified
this is true of the kernel we're now working with (arche-6.0).
Alex Elder [Tue, 24 May 2016 18:34:50 +0000 (13:34 -0500)]
greybus: fix pointless null check
Coccinelle points out that a call in gb_lights_channel_free() to
flush_work() is passed which is always non-null. Prior to the
call, there is an unnecessary check to see if that address is null.
Get rid of the test.
Alex Elder [Tue, 24 May 2016 18:34:49 +0000 (13:34 -0500)]
greybus: eliminate unneeded null check
Coccinelle points out that debugfs_remove_recursive() handles a null
argument properly, so there's no need to check for NULL before
making the call. I have verified this is true of the kernel we're
now working with (arche-6.0).
Alex Elder [Tue, 24 May 2016 18:34:48 +0000 (13:34 -0500)]
greybus: fix unbalanced mutex
Running "make coccicheck" on the Greybus code reports that
gb_mmc_get_ro() and gb_mmc_get_cd() can return without releasing
the mutex it acquired if there's an error. Fix this.
Alex Elder [Tue, 24 May 2016 18:34:47 +0000 (13:34 -0500)]
greybus: report right error value
Running "make coccicheck" on the Greybus code discovered that
an error message in gb_camera_debugfs_init() was interpreting
the wrong value in reporting the error code. Fix that.
Vaibhav Agarwal [Fri, 27 May 2016 05:19:24 +0000 (10:49 +0530)]
greybus: es2: Release reserved cports CDSI0 and CDSI1
Unique ids were reserved for CDSI0 and CDSI1 during _probe, however
missed to release those ids during disconnect. This causes a memory leak
of 128 bytes for each iteration of unipro_reset. Fix this.
Vaibhav Agarwal [Fri, 27 May 2016 05:19:23 +0000 (10:49 +0530)]
greybus: hd: Add API to release reserved CPorts
It is required to release all unique ids registered via ida_get_simple
to avoid any possible memory leak. cport_release() already exists with
special handling for ES2_CPORT_CDSI1, i.e. updating in_use flag without
removing associated ida.
So, added another API to release reserved cports CDSI0 and CDSI1. This
is intended to be used only during es2_destroy().
Alex Elder [Tue, 24 May 2016 04:05:32 +0000 (23:05 -0500)]
greybus: tracing: define interface traces
Define a new gb_module trace point event class, used to trace events
associated with the interface abstraction. Define four basic trace
points for this--creation time, drop of last reference, before
registring interfaces and after de-registering them. In addition,
define traces for activating and deactivating, and enabling and
disabling an interface.
Alex Elder [Tue, 24 May 2016 04:05:31 +0000 (23:05 -0500)]
greybus: tracing: add module traces
Define a new gb_module trace point event class, used to trace events
associated with the module abstraction. Define four basic trace
points for this--creation time, drop of last reference, before
registring interfaces and after de-registering them.
Alex Elder [Tue, 24 May 2016 04:05:30 +0000 (23:05 -0500)]
greybus: tracing: fix hd traces
Currently there are two trace points defined for the Greybus host
device structure. One records information when a message gets sent,
and another when it gets received. Neither of these is really a
host device event.
We have trace points defined for messages that dump information
about all sent and received messages. As a result, the information
about sending messages over a host is redundant, and can go away.
(Note that the message traces may need a little refinement so they
produce all desired information.)
Instead of these trace points, define some that are directly
related to the host device abstraction: when one is created,
added, deleted, or released (destroyed). These do not require
a CPort ID or payload size, so eliminate those two parameters
from the host device trace point prototype. Change the trace
information recorded for a host device to be just a subset of
interesting fields in a host device.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Core will never call host-device callbacks with invalid arguments (and
that would still need to be verified in bridge firmware anyway), so
remove the redundant and insufficient sanity check from the callbacks.
Vaibhav Hiremath [Tue, 24 May 2016 13:02:04 +0000 (18:32 +0530)]
greybus: arche-platform: Enable SVC clock during FW_FLASHING state
The issue is, as part of kernel-only build we started seeing
failures in SVC FW flashing. It was reproducible easily in kernel-only
build, but never observed on Android build.
During debugging, there were couple of observations,
1. If SVC clock enabled and disables (which is REFCLK_MAIN), then SVC FW
flashing works.
2. If we do not switch SVC to HSE (external clock source) it works.
Recently, SVC code has been updated to switch HSE clock, so removing
it (remove/skip rcc_switch_ara_pll() fn) would use internal clock only.
As per STM32 spec, for flashing through USART we do not need
to enable HSE, but the above observation contradicts with it.
There is still something missing in terms of understanding of how STM32
device functions as far as Flashing is concerned. There is something
hidden in HW, which probably still need to identify.
So as a interim solution we will enable clock for FW_FLASHING state,
which seems to be fixing the issue here.
Testing Done: Tested on EVT1.5 with arche6.0 and kernel-only build.
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Tested-by: Michael Scott <michael.scott@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Vaibhav Hiremath [Tue, 24 May 2016 13:02:03 +0000 (18:32 +0530)]
greybus: arche-platform: Enter ACTIVE state only from OFF state
Make sure that, transition to active state happens only from OFF state.
Instead of imposing the restriction to user-space, driver internally
switches to OFF state and then to ACTIVE state.
Testing Done: Tested on EVT1.5 platform.
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Tested-by: Michael Scott <michael.scott@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Eli Sennesh [Mon, 16 May 2016 18:55:17 +0000 (14:55 -0400)]
greybus: update UniPro Set Interface Power Mode operation to match spec
Bring the gb_svc_intf_set_power_mode() up-to-date with the current Greybus
specification. This largely involves adding more members to the structure
sent across the wire. Also change the camera code to use the new
operation properly, with default values passed for the new necessary
arguments. The correctness of these default values is confirmed via testing
and by asking Rob Johnson.
Testing Done: Took a picture with a camera module, received error code
when passing deliberately incorrect values for new parameters, got proper
-EIO and Greybus result code printed when operation stopped halfway
through.
Associated Firmware Changes: 6810-6812 on Gerrit for SW-1239, 6870 and
5612-5613 on Gerrit for SW-2945
Signed-off-by: Eli Sennesh <esennesh@leaflabs.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Bryan O'Donoghue [Mon, 23 May 2016 14:01:08 +0000 (15:01 +0100)]
greybus: Fix unbalanced irq_enable() backtrace
Tip-of-tree is exhibiting a backtrace when loading-up the set of greybus
kernel modules due to calling arche_platform_wd_irq_en() directly after a
call to devm_request_threaded_irq().
At the point we call arch_platform_wd_irq_en() the relevant IRQ will
already be enabled. What we want to do in this situation is configure the
GPIO line as an input. This patch fixes the backtrace by supplanting
arche_platform_wd_irq_en() with
gpio_direction_input(arche_pdata->wake_detect_gpio) in
arche_platform_probe().
David Lin [Sat, 21 May 2016 01:37:02 +0000 (18:37 -0700)]
greybus: legacy: remove protocol.o from the makefile
Commit 0917cba11 ("legacy: remove legacy driver support")
removed protocol.c, however, the corresponding target in the Makefile
was not removed therefore broken the build.
Testing Done:
- Build & boot on EVT1.5
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>
Alex Elder [Fri, 20 May 2016 16:44:56 +0000 (11:44 -0500)]
greybus: tracing: eliminate "location" comments
Each message event has a set of comments preceeding its definition.
One of them, "location", indicates where that event is used. I
am certain that this comment will become out of date very easily.
Hopefully just the name of the event is a good enough suggestion
about where it will be used.
Alex Elder [Fri, 20 May 2016 16:44:55 +0000 (11:44 -0500)]
greybus: tracing: define events using macros
A tracepoint event is defined with TP_PROTO() and TP_ARGS macros
that match that of the event's class. A lot of repetition (and
opportunity for inadvertent errors) in tracepoint event definitions
can be eliminated by using a macro. Define and use class-specific
event definition macros for gb_message and gb_host_device class
events.
Alex Elder [Fri, 20 May 2016 16:59:57 +0000 (11:59 -0500)]
greybus: add operation traces
Define a new gb_operation event class, and define and use trace
events that record when an operation is created, finally destroyed,
and when its active count changes.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Now, since AP module does not send any signal to SVC, so it
automatically restricts the wake/detect gpio to input.
So rename assert_wakedetect() fn to arche_platform_wd_irq_en(),
as per implementation.
Vaibhav Hiremath [Tue, 17 May 2016 17:09:46 +0000 (22:39 +0530)]
greybus: arche-platform: Do not assert wake/detect signal to SVC
With new definition of AP module boot flow (from HotPlug camp),
AP is not supposed to send any wake/detect signal to SVC, instead,
during boot SVC would straight away send wake_out pulse on wake/detect
line.
Note that, pin configuration of wake/detect line would be set to
active-high by default, so wake/detect line would always stay high,
unless SVC drives it. AP module uses wake/detect line strictly in input
mode.
Testing Done: Tested on EVT1.5 platform.
Note: We are yet to decide on PM support for APBx, so we may need to
generate/handshake with SVC over wake/detect line in the future. As of
now, follow the implementation and add stuff as and when they come.
Sandeep Patil [Thu, 19 May 2016 15:52:39 +0000 (08:52 -0700)]
greybus: gpbridge: rename 'gpbridge' to 'gbphy' everywhere
The 'gpbridge' name didn't relaly reflect what the bus is; which
is a bus for bridged-phy devices. So, rename all instances
of 'gpbridge' to more appropriate 'gbphy'
Testing Done:
Build and boot tested. 'lsgb' will stop displaying 'GPBridge' devices
until I change the library to reflect this change.
Jeffrey Carlyle [Thu, 19 May 2016 01:55:13 +0000 (18:55 -0700)]
greybus: interface: retry enumeration of UniPro-only modules
Greybus modules will sometimes fail to send the mailbox poke and
erroneously be enumerated as UniPro-only modules. The root cause for
this on the module side is not fully understand, but it seems that this
may be due to "the bootrom bug:" a known problem with the bootrom where
linkup will occasionally fail because of a race condition.
Before the new hotplug code was implemented in the firmware, the SVC
would retry enumeration of modules that did not send the mailbox poke;
this patch ports that functionality to the AP.
Alex Elder [Tue, 17 May 2016 14:13:16 +0000 (09:13 -0500)]
greybus: connection: verify disabled when destroyed
A connection must be in DISABLED state before it gets destroyed.
Warn if this is ever not the case (and do the disconnect) before
proceeding with connection destruction.
Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>