From: vamshi gajjela <vamshigajjela@google.com>
To: sboyd@kernel.org, abelvesa@kernel.org
Cc: abel.vesa@oss.qualcomm.com, jwylder@google.com,
linux-kernel@vger.kernel.org, vamshigajjela@google.com
Subject: [PATCH v4 0/2] spmi: core: Add generic DebugFS interface for bus inspection
Date: Fri, 30 Oct 2026 10:29:45 +0530 [thread overview]
Message-ID: <20261030045947.3049598-1-vamshigajjela@google.com> (raw)
From: Vamshi Gajjela <vamshigajjela@google.com>
This series introduces a generic, controller-agnostic DebugFS interface in the
SPMI core under /sys/kernel/debug/spmi/spmi-<nr>/ to inspect registered
controllers and perform SPMI transactions during board bringup and debugging.
Patch 1/2 renames drivers/spmi/spmi.c to spmi-core.c so that the core driver
and optional debugfs support can be linked into the spmi.ko composite module.
Patch 2/2 adds the DebugFS interface (name and xfer) along with its ABI
documentation under Documentation/ABI/testing/debugfs-spmi.
Changes in v4:
- Rebased onto spmi-next (8f70c729e68c).
- Split the rename of drivers/spmi/spmi.c -> spmi-core.c into a separate
preparatory patch.
- Removed the 'detect' debugfs entry as MIPI SPMI does not mandate a universal
register address across all slave devices, and probing 0x0000 fails on
controllers with channel/register access policies such as Qualcomm PMIC Arb.
- Dropped redundant Runtime PM calls from spmi-debugfs.c since SPMI controller
drivers manage their own runtime PM inside their transaction callbacks.
- Gated raw write ('w') and command ('c') operations behind
#undef SPMI_ALLOW_WRITE_DEBUGFS (matching regmap-debugfs.c) so that the
interface is read-only by default unless explicitly enabled in source.
- Updated Date and KernelVersion in Documentation/ABI/testing/debugfs-spmi.
- Link to v3: https://lore.kernel.org/r/20261019202107.888262-1-vamshigajjela@google.com
Changes in v3:
- Move internal SPMI core command helpers (spmi_cmd(), spmi_read_cmd(),
spmi_write_cmd()) and DebugFS prototypes out of the public
include/linux/spmi.h header into a local drivers/spmi/spmi-internal.h
header.
Changes in v2:
- Rename spmi.c to spmi-core.c and link spmi-debugfs.o into the composite
spmi.o module so CONFIG_SPMI=m builds cleanly with CONFIG_DEBUG_FS=y.
- Route DebugFS bus operations through spmi_read_cmd(), spmi_write_cmd(),
and spmi_cmd() instead of calling controller callbacks directly,
preserving SPMI tracepoints and core validation.
- Allocate a per-open-file struct spmi_xfer_ctx in open() instead of
sharing a controller-wide buffer, avoiding races across concurrent file
descriptors, and store struct dentry *debugfs directly on
struct spmi_controller.
- Reset *ppos = 0 on register read commands so repeated transactions on
the same open file descriptor work without manual seeking.
- Restrict SPMI_CMD_ZERO_WRITE at address 0x00 to 7-bit payloads
(data[0] <= 0x7f) per the MIPI SPMI specification, falling back to
SPMI_CMD_WRITE for 8-bit values.
- Parse register addresses with kstrtou16() so values above 0xffff are
rejected instead of silently truncated.
- Update Documentation/ABI/testing/debugfs-spmi to document per-fd xfer
buffers and 7-bit Zero Write opcode selection.
Vamshi Gajjela (2):
spmi: core: Rename spmi.c to spmi-core.c
spmi: core: Add generic DebugFS interface for bus inspection
Documentation/ABI/testing/debugfs-spmi | 68 +++++
MAINTAINERS | 1 +
drivers/spmi/Makefile | 2 +
drivers/spmi/{spmi.c => spmi-core.c} | 20 +-
drivers/spmi/spmi-debugfs.c | 341 +++++++++++++++++++++++++
drivers/spmi/spmi-internal.h | 28 ++
include/linux/spmi.h | 6 +
7 files changed, 460 insertions(+), 6 deletions(-)
create mode 100644 Documentation/ABI/testing/debugfs-spmi
rename drivers/spmi/{spmi.c => spmi-core.c} (97%)
create mode 100644 drivers/spmi/spmi-debugfs.c
create mode 100644 drivers/spmi/spmi-internal.h
--
2.56.0.317.g454f8302e1-goog
next reply other threads:[~2026-10-30 4:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 4:59 vamshi gajjela [this message]
2026-10-30 4:59 ` [PATCH v4 1/2] spmi: core: Rename spmi.c to spmi-core.c vamshi gajjela
2026-10-30 16:37 ` Abel Vesa
2026-10-30 4:59 ` [PATCH v4 2/2] spmi: core: Add generic DebugFS interface for bus inspection vamshi gajjela
2026-10-30 16:45 ` Abel Vesa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261030045947.3049598-1-vamshigajjela@google.com \
--to=vamshigajjela@google.com \
--cc=abel.vesa@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=jwylder@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®