This series contains two small fixes for the Greybus audio manager:
1) Fix a NULL dereference in gb_audio_manager_get_module().
2) Drop a stale TODO in the module release callback.
Both are correctness / cleanup fixes with no functional change beyond
preventing crashes.
Thanks,
Hardik
Hi,
This patchset brings support for Silicon Labs' CPC protocol as transport
layer for Greybus. CPC stands for Co-Processor Communication and
currently exists as a userspace daemon [1] that enables multiple
applications on a coprocessor to share a single physical link to a Linux
host, using a protocol loosely based on HDLC [2].
While the userspace implementations serves its purpose, it has some
redundancies with Greybus that makes it not very suitable for kernel
integration as-is, and so the protocol has been modified to better fit
with Greybus. Even though kernel and userspace implementations share the
same name, they are not the same protocol and are not compatible. The
kernel integration with Greybus is intended to superseed the userspace
implementation.
CPC is introduced as a module that sits between Greybus and CPC Host
Device Drivers implementations, like SDIO or SPI. This patchset includes
SDIO as physical layer but the protocol is not final and might change,
it's mostly there to showcase all the elements.
+----------------------------------------------------+
| Greybus |
+----------------------------------------------------+
/|\
|
\|/
+----------------------------------------------------+
| CPC |
+----------------------------------------------------+
/|\ /|\ /|\
| | |
\|/ \|/ \|/
+----------+ +---------+ +-----------+
| SDIO | | SPI | | Others |
+----------+ +---------+ +-----------+
CPC implements some of the features of Unipro that Greybus relies upon,
like reliable transmission. CPC takes care of detecting transmission
errors and retransmit frames if necessary, but that feature is not part
of the RFC to keep it concise. There's also a flow-control
feature, preventing sending messages to already full cports.
In order to implement these features, a 4-byte header is prepended to
Greybus messages, making the whole header 12 bytes (Greybus header is 8
bytes).
This RFC starts by implementing a shim layer between physical bus
drivers (like SDIO and SPI) and Greybus, and progressively add more
elements to it to make it useful in its own right. Finally, an SDIO
driver is added to enable the communication with a remote device.
[1] https://github.com/SiliconLabs/cpc-daemon
[2] https://en.wikipedia.org/wiki/High-Level_Data_Link_Control
Changes in v3:
- addressed Jerome's review comments, mostly for SDIO driver
- rewrote cover letter and commit messages across the series
Changes in v2:
- addressed review comments and errors reported by kernel bot
- for SDIO driver, remove padding between headers and payloads when
aggregating packets together
Damien Riégel (13):
greybus: cpc: add minimal CPC Host Device infrastructure
greybus: cpc: introduce CPC cport structure
greybus: cpc: use socket buffers instead of gb_message in TX path
greybus: cpc: pack cport ID in Greybus header
greybus: cpc: switch RX path to socket buffers
greybus: cpc: introduce CPC header structure
greybus: cpc: account for CPC header size in RX and TX path
greybus: cpc: add and validate sequence numbers
greybus: cpc: acknowledge all incoming messages
greybus: cpc: use holding queue instead of sending out immediately
greybus: cpc: honour remote's RX window
greybus: cpc: let host device drivers dequeue TX frames
greybus: cpc: add private data pointer in CPC Host Device
Gabriel Beaulieu (1):
greybus: cpc: add CPC SDIO host driver
MAINTAINERS | 6 +
drivers/greybus/Kconfig | 2 +
drivers/greybus/Makefile | 2 +
drivers/greybus/cpc/Kconfig | 24 ++
drivers/greybus/cpc/Makefile | 9 +
drivers/greybus/cpc/cpc.h | 75 ++++++
drivers/greybus/cpc/cport.c | 112 ++++++++
drivers/greybus/cpc/header.c | 136 ++++++++++
drivers/greybus/cpc/header.h | 52 ++++
drivers/greybus/cpc/host.c | 319 ++++++++++++++++++++++
drivers/greybus/cpc/host.h | 63 +++++
drivers/greybus/cpc/protocol.c | 170 ++++++++++++
drivers/greybus/cpc/sdio.c | 480 +++++++++++++++++++++++++++++++++
13 files changed, 1450 insertions(+)
create mode 100644 drivers/greybus/cpc/Kconfig
create mode 100644 drivers/greybus/cpc/Makefile
create mode 100644 drivers/greybus/cpc/cpc.h
create mode 100644 drivers/greybus/cpc/cport.c
create mode 100644 drivers/greybus/cpc/header.c
create mode 100644 drivers/greybus/cpc/header.h
create mode 100644 drivers/greybus/cpc/host.c
create mode 100644 drivers/greybus/cpc/host.h
create mode 100644 drivers/greybus/cpc/protocol.c
create mode 100644 drivers/greybus/cpc/sdio.c
--
2.52.0
Replace sprintf() with sysfs_emit() in the protocol_id_show() sysfs
attribute function. This code is safe as-is, but replace
sprintf() with sysfs_emit() because we are trying to get rid of calls
to sprintf() as part of kernel hardening; sysfs_emit() is more
appropriate in this context.
Signed-off-by: Neel Bullywon <neelb2403(a)gmail.com>
---
This was compile-tested only (no VM/hardware used)
Changes in v2:
- Subject: change to imperative "Replace" (was "Replaced").
- Wording and line breaks adjusted in the commit body for clarity.
Changes in v3:
- Clarify what "safe" means (buffer is PAGE_SIZE) per Dan Carpenter's
suggestion.
- Reflow lines to avoid awkward breaks.
---
drivers/staging/greybus/gbphy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
index 60cf09a302a7..55f132b09cee 100644
--- a/drivers/staging/greybus/gbphy.c
+++ b/drivers/staging/greybus/gbphy.c
@@ -31,7 +31,7 @@ static ssize_t protocol_id_show(struct device *dev,
{
struct gbphy_device *gbphy_dev = to_gbphy_dev(dev);
- return sprintf(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
+ return sysfs_emit(buf, "0x%02x\n", gbphy_dev->cport_desc->protocol_id);
}
static DEVICE_ATTR_RO(protocol_id);
base-commit: de0674d9bc69699c497477d45172493393ae9007
--
2.44.0
This series fixes checkpatch.pl checks highlighted for files
in greybus, for mutex declaration comments, and styling issues.
Changes in v3:
- Added cover letter detailing changes made in subsequent versions of
patch-sets.
- v2 patch-set was only emailed to maintainers. The email was forwarded
to the lists, but this rendered the patch-set corrupted. v3 hopes to
correct this.
Changes in v2:
- Split patch 1 into two individual patches 1/4 and 2/4 to keep logical
changes separate.
Rachit Dhar (4):
staging: greybus: added comment to mutex declaration in
fw-management.c
staging: greybus: fixed styling issue in fw-management.c
staging: greybus: resolved checkpatch checks for raw.c
staging: greybus: resolved checkpatch checks for light.c
drivers/staging/greybus/fw-management.c | 5 +++--
drivers/staging/greybus/light.c | 4 ++--
drivers/staging/greybus/raw.c | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
--
2.43.0