Thanks to Vinod and Stephen for reviewing v1 patchset
This v2 patchset adds basic stream support for SLIMbus devices and controllers. Mostly inspired by soundwire stream patches. But slimbus stream is much simpler compared to soundwire
From slim_device side, we have below 6 new apis.
slim_stream_allocate() - allocating runtime slim stream slim_stream_prepare() - to configure runtime stream with config slim_stream_enable() - enable channels/ports for data slim_stream_disable() - disable channels/ports. slim_stream_unprepare() - un configure runtime stream slim_stream_free() - free all associated memory.
From Controller side:
Data channel Management and reconfiguration messages are applicable for all the controllers which are inline with SLIMbus specs. However light weight controller like NGD which have user specific implementation of some messages need to be invoked instead of standard message commands. For usecases like this simple enable/disable stream apis are provided.
Assumptions: 1> Current design assumes that the channel and ports are statically allocated to the device during SoC integration, which is the case with all the Qualcomm SoCs. 2> One-to-One mapping between Port and Channel, SLIMBus versions earlier than 2.0 has only one endpoint per port. Current patchset can be extended to support more than one endpoints per port. 3> Only audio usecase, This patchset only supports Isochronous and Push/Pull transport protocols, which are sufficient for audio use cases. 4> DSP does all the data handling for the allocated channels. Which is true for Qcom SoCs.
TODO: Bandwidth management.
Dependency: This patchset has dependency on the NGD driver https://patchwork.kernel.org/patch/10474959/
Tested this patchset with WCD9335 codec playback and capture on DB820c using 4.18-rc1 with qdsp6 + slim tx patches merged in sound.git.
I have pushed my working branch to [1] incase someone want to try.
[1]:https://git.linaro.org/people/srinivas.kandagatla/linux.git/log/?h=slimbus-n...
Changes since v1 (https://lwn.net/Articles/758100/): - removed redundant state machine checks for audio usecases, suggested by Vinod. - fixed few typos. - removed irqsave/restore spinlock variant spotted by Vinod. - general cleanups suggested by Stephen and Vinod. thanks, srini
Srinivas Kandagatla (2): slimbus: stream: add stream support slimbus: ngd: add stream support
Documentation/driver-api/slimbus.rst | 5 + drivers/slimbus/Makefile | 2 +- drivers/slimbus/core.c | 2 + drivers/slimbus/qcom-ngd-ctrl.c | 149 ++++++++++- drivers/slimbus/slimbus.h | 189 ++++++++++++++ drivers/slimbus/stream.c | 477 +++++++++++++++++++++++++++++++++++ include/linux/slimbus.h | 46 ++++ 7 files changed, 867 insertions(+), 3 deletions(-) create mode 100644 drivers/slimbus/stream.c