[RFC PATCH v2 0/1] gpio: add simple logic analyzer using polling

From: Wolfram Sang
Date: Wed May 19 2021 - 09:26:13 EST


The bravery continues with the second RFC for the in-kernel logic
analyzer based on GPIO polling with local irqs disabled. Besides the
driver, there is also a script which isolates a CPU to achieve the best
possible result. I am aware of the latency limitations. However, the
intention is only for debugging. Especially for remote debugging and to
get a first impression, this has already been useful. Documentation is
within the patch, to get a better idea what this is all about.

Changes since RFC v1:

* moved from misc/ to gpio/. Thanks to Linus and Bartosz for offering a
home for this
* renamed from "simple logic analyzer" to "sloppy logic analyzer"
everywhere to make its limitations crystal clear
* moved the parser for trigger data from the kernel into the script.
Much cleaner kernel code but passing binary data now. We'll see...
* all gpios now must be named. This removes ugly fallback code and
allows to use generic device properties instead of OF properties only.
* added and updated documentation
* triggers are also now checked at sample speed, not full speed
* replaced pr_* printouts with dev_*
* removed bashisms in the script (tested with bash, dash, and busybox
ash)
* depends on EXPERT now
* small bugfixes, refactoring, cleanups all around

Thanks to Andy, Linus, Randy, and Ulrich for suggestions and testing.

A branch with preparation for the Renesas Salvator-XS boards is here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/gpio-logic-analyzer-v2

The documentation is also available online on the elinux wiki:
https://elinux.org/Kernel_GPIO_Logic_analyzer

Looking forward to comments and especially further tests with different
use cases than mine. I have looked enough at the code, fresh view would
really help. And still, if somebody has a pointer how to detect if a
task was requested to be killed (while irqs and preemption are
disabled), I'd appreciate that to avoid the currently unkillable
sub-process.

All the best,

Wolfram

Wolfram Sang (1):
misc: add sloppy logic analyzer using polling

.../dev-tools/gpio-sloppy-logic-analyzer.rst | 72 ++++
Documentation/dev-tools/index.rst | 1 +
drivers/gpio/Kconfig | 17 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio-sloppy-logic-analyzer.c | 317 ++++++++++++++++++
tools/gpio/gpio-sloppy-logic-analyzer | 200 +++++++++++
6 files changed, 608 insertions(+)
create mode 100644 Documentation/dev-tools/gpio-sloppy-logic-analyzer.rst
create mode 100644 drivers/gpio/gpio-sloppy-logic-analyzer.c
create mode 100755 tools/gpio/gpio-sloppy-logic-analyzer

--
2.30.2