summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/hd.h
AgeCommit message (Collapse)AuthorFilesLines
2017-01-07staging: greybus: remove timesync protocol supportGreg Kroah-Hartman1-7/+0
While the timesync protocol was a great idea, it never ended up getting implemented by any known hardware devices. It's also a bit "interesting" in how it ties into the platform controller. So, just remove it for now. It's not needed, no one uses it, and it's a stumbling block in getting the greybus core code merged out of the staging tree. If anyone wants it in the future, reverting this patch is a great place to start from. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Johan Hovold <johan@kernel.org> Reviewed-by: Alex Elder <elder@kernel.org> Acked-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-26greybus: hd/es2: remove obsolete callbacksJohan Hovold1-3/+0
Remove the now obsolete ping and cport_features_enable/disable callbacks. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-08-11greybus: hd: add cport_shutdown callbackJohan Hovold1-0/+2
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. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-08-11greybus: hd/es2: add cport_clear callback and ARPCJohan Hovold1-0/+2
Add a host-device cport_clear callback, which will be called as part of the new connection tear-down sequence to reset the CPort state. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-08-11greybus: hd/es2: add cport_quiesce callback and ARPCJohan Hovold1-0/+2
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. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-08-11greybus: hd/es2: add cport_connected callback and ARPCJohan Hovold1-0/+1
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. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-16greybus: hd: arche-platform: implement greybus shutdownDavid Lin1-0/+1
Implement platform driver shutdown callback to perform proper greybus shutdown so that the userspace unipro_shutdown service that shuts down the APB/SVC abruptly can be removed. The shutdown callback in arche-platform will first remove SVC so that all the Interface can be Deactivated in a sequence according to the spec before powering off the APB: Before: -> Arche/APB power off -> SoC power off After this patch: -> HD shutdown -> SVC shutdown -> Module shutdown -> Interface shutdown -> Bundle shutdown -> Arche/APB power off -> SoC power off Testing Done: - Observe all Interfaces are deactivated in the log during shutdown - Measure power off current and make sure no regression Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-24greybus: hd: add flag argument to cport_enable callbackJohan Hovold1-1/+2
Add a flag argument to the host-device cport_enable callback that can be used to provide hints about the connection being created (e.g. connection priority). Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-27greybus: connection: add flush host-device callbackJohan Hovold1-0/+1
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. Suggested-by: Mitchell Tasman <tasman@leaflabs.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-27greybus: connection: implement proper connection closureJohan Hovold1-0/+1
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>
2016-05-27greybus: hd: Add API to release reserved CPortsVaibhav Agarwal1-0/+1
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(). Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-15greybus: hd: Add TimeSync APBridge commandsBryan O'Donoghue1-0/+7
This patch adds a number of USB Vendor commands to es2.c to enable TimeSync in the bridge. Adds: - es2.c::timesync_enable(u8 count, u64 frame_time, u32 strobe_delay, u32 refclk); Commands APBx to enable timers and clocks to track a pulse-train of incoming TIME_SYNC strobes with strobe_delay microseconds between each. Provides the reference clock the AP is using to track FrameTime. It is the responsibility of APBx to adequately track the FrameTime based on the indicated AP refclk. Once this command has succeeded APBx may not transition to a low-power state were FrameTime counters stop. This function is initiated from the timesync worker thread logic when re-synchronizing frame-time throughout the system. TimeSync is at this time enabled for all APBx active in the system i.e. currently APB2 will not receive TimeSync commands until it becomes a registered host-device in Greybus. - es2.c::timesync_disable(void) Commands APBx to discontinue tracking of FrameTime. After this operation completes APBx may transition to a low-power state where timer-clocks stop operating. - es2.c::timesync_authoritative(u64 *frame_time) Provides an authoritative time for each TIME_SYNC strobe to APBx. APBx must align its local FrameTime to the authoritative clock. - es2.c::timesync_get_last_event(u64 *frame_time) Returns the FrameTime at the last SVC_TIMESYNC_PING to the AP Module. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-13greybus: hd: generalise cport allocationJohan Hovold1-1/+5
Generalise CPort allocation by allowing host-device drivers to override the default implementation. Also pass the connection flags down the stack as such information is needed for proper CPort allocation. Specifically, this will initially be used to allow the camera driver to allocate the dedicated CDSI CPorts. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-13greybus: es2: clean up CDSI CPort reservationJohan Hovold1-0/+1
Clean up the CDSI CPort reservation by adding a host-device helper and CPort defines. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-13greybus: hd: move CPort allocation to host-device codeJohan Hovold1-0/+3
Move host-device CPort allocation to the host-device code. Proper CPort allocation requires knowledge of the hardware and must be handled by the host-device driver. This is an intermediate step that moves the generic CPort-allocation code to the host-device code. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25greybus: core: add module abstractionJohan Hovold1-1/+1
Add Greybus module abstraction that will be used to implement controlled module removal (eject) and represent module geometry. Greybus module devices correspond to physical modules and have one or more interfaces. Modules have an id that is identical to the id of their primary interface, which in turn is the interface with lowest numbered id. The module name is constructed from the bus and module id: <bus_id>-<module_id> Interfaces, bundles, and control devices are consequently renamed as <bus_id>-<module_id>.<interface_id> <bus_id>-<module_id>.<interface_id>.<bundle_id> <bus_id>-<module_id>.<interface_id>.ctrl As before, interface ids (and therefore in a sense now also module ids) correspond to physical interface positions on the frame. Modules have the following attributes: module_id num_interfaces where module_id is the id of the module and num_interface the number of interfaces the module has. Note that until SVC module-size detection has been implemented, all interfaces are considered to be part of 1x2 modules. Specifically, the two interfaces of a 2x2 module will be presented as two 1x2 modules for now. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-30greybus: core: fix two container-of macrosJohan Hovold1-1/+1
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>
2016-03-04greybus: hd: rename CPort-features callbacksJohan Hovold1-2/+2
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>
2016-02-24greybus: connection: add api to {en,dis}able unipro fct flowFabien Parent1-0/+2
In order to support mailbox-free control cport init on the bridges the AP must be able to enable/disable the flow of unipro fct tokens. Add a new API that will enable or disable on APBA the flow of fct tokens. Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-12greybus: host: provide "generic" apbridge output callsGreg Kroah-Hartman1-0/+4
Provide a new function, gb_hd_output() to send data to the apbridge. This is useful for the camera and audio drivers that need to do this type of messaging. The camera driver is converted to use this new function, the audio driver can use it when it gets merged later. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Tested-by: Mark Greer <mgreer@animalcreek.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2015-12-08greybus: svc: create svc along with host deviceJohan Hovold1-2/+0
Create svc device along with host-device and move the svc-connection to the svc structure. The svc connection is enabled when registering the host device, but as the SVC protocol is currently driven by the SVC, we need to defer registration of the svc device to the connection request handler. 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>
2015-11-25greybus: kill the endoJohan Hovold1-1/+0
Remove the now unused endo and module code. Note that the never-implemented serial and version attributes of the endo can be implemented as svc attributes if needed. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25greybus: hd: fix svc-connection handlingJohan Hovold1-1/+1
Create the svc connection when registering the host-device and remove the current svc connection hacks that "upgraded" the svc connection once the endo id and ap interface id was known. Note that the old implementation was partly based on a misunderstanding as it was the remote interface id, rather than the local AP interface id, that used to define a connection (but we also needed the endo_id). The remote interface is no longer needed as static connections, such as the svc connection, are now simply defined by the host-device and host cport id. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25greybus: hd: make host device a deviceJohan Hovold1-2/+6
Make the host device a proper device in the kernel device model. Host devices will be our new greybus-bus root devices. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04greybus: hd: fix host-device life time issuesJohan Hovold1-1/+3
Fix host-device life time issues by separating host-device allocation from registration. This is needed both to make sure that all host-device resources are available before registering the device and to prevent such resources from being deallocated while the device is still in use during device removal. This specifically fixes the following warnings during es1 and es2 disconnect: usb 1-1.1: No free CPort OUT urbs, having to dynamically allocate one! Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-04greybus: hd: use common prefix for exported functionsJohan Hovold1-5/+5
Rename the exported functions using the common gb_-prefix. 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>
2015-11-04greybus: hd: rename host-driver structureJohan Hovold1-6/+3
Rename host-driver structure to gb_hd_driver to more clearly separate it from the host-device structure. Also remove an outdated description of the struct. 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>
2015-11-04greybus: hd: rename host-device structureJohan Hovold1-10/+9
Rename host-device structure gb_host_device to match our other structures. 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>
2015-11-04greybus: create host-device compilation unitJohan Hovold1-0/+61
Move everything host-device related to hd.c and hd.h. 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>