mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: vamshi gajjela <vamshigajjela@google.com>
To: Stephen Boyd <sboyd@kernel.org>, Abel Vesa <abelvesa@kernel.org>
Cc: Jim Wylder <jwylder@google.com>,
	linux-kernel@vger.kernel.org,
	 Vamshi Gajjela <vamshigajjela@google.com>
Subject: [PATCH v5 0/2] spmi: Add generic DebugFS interface for bus inspection
Date: Sat, 31 Oct 2026 02:07:26 +0530	[thread overview]
Message-ID: <20261030203728.3784902-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 v5:
- Drop "core:" from patch subject prefixes to match SPMI core convention.
- Collect Abel Vesa's Reviewed-by tag on Patch 1/2.
- Update KernelVersion from 7.4 to 7.5 in Documentation/ABI/testing/debugfs-spmi.
- Drop debugfs return value and root checks, drop redundant NULL assignment in
  spmi_debugfs_exit()/spmi_controller_debugfs_remove(), and use
  dev_name(&ctrl->dev) for the controller directory name in
  drivers/spmi/spmi-debugfs.c.
- Link to v4: https://lore.kernel.org/r/20261030045947.3049598-1-vamshigajjela@google.com

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: Rename spmi.c to spmi-core.c
  spmi: 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            | 331 +++++++++++++++++++++++++
 drivers/spmi/spmi-internal.h           |  28 +++
 include/linux/spmi.h                   |   6 +
 7 files changed, 450 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


             reply	other threads:[~2026-10-30 20:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 20:37 vamshi gajjela [this message]
2026-10-30 20:37 ` [PATCH v5 1/2] spmi: Rename spmi.c to spmi-core.c vamshi gajjela
2026-10-30 20:37 ` [PATCH v5 2/2] spmi: Add generic DebugFS interface for bus inspection vamshi gajjela
2026-11-03 10:00   ` 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=20261030203728.3784902-1-vamshigajjela@google.com \
    --to=vamshigajjela@google.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®