Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Vishwaroop A <va@nvidia.com>
To: <broonie@kernel.org>, <linux-spi@vger.kernel.org>
Cc: <smangipudi@nvidia.com>, <jonathanh@nvidia.com>,
	<thierry.reding@gmail.com>, <corbet@lwn.net>,
	<linux-doc@vger.kernel.org>, <va@nvidia.com>
Subject: [PATCH v3 0/2] spi: add sysfs interface for userspace device instantiation
Date: Mon, 4 May 2026 07:40:35 +0000	[thread overview]
Message-ID: <20260504074037.704833-1-va@nvidia.com> (raw)

Development boards such as the Jetson AGX Orin expose SPI buses on
expansion headers so that users can connect and interact with SPI
peripherals from userspace via /dev/spidevB.C character devices.

Today, instantiating spidev devices on upstream kernels is impractical:
the spidev driver rejects bare "spidev" compatible strings in DT, and
vendor-specific strings have been rejected by DT maintainers.

This series adds an I2C-style new_device/delete_device sysfs interface
to SPI host controllers, enabling runtime device instantiation from
userspace without any device-tree changes.

Patch 1 adds the core sysfs interface (new_device/delete_device).
Patch 2 adds user-facing documentation and ABI entries.

Changes in v3:
  - Made the entire feature conditional on CONFIG_SPI_DYNAMIC using
    #if IS_ENABLED(CONFIG_SPI_DYNAMIC) preprocessor guards, since this
    adds a new way of dynamically instantiating and removing SPI
    devices and the add_lock locking in spi_unregister_controller() is
    already conditional on CONFIG_SPI_DYNAMIC (Mark Brown)
  - Wrapped userspace_clients list, lock, and userspace_node struct
    members in #if IS_ENABLED(CONFIG_SPI_DYNAMIC) in spi.h
  - Started a new thread instead of replying to v2 (Mark Brown)

Changes in v2:
  - Fixed a race between new_device_store() and
    spi_unregister_controller(): hold ctlr->add_lock across both
    __spi_add_device() and the list insertion so the two operations
    are atomic with respect to controller teardown (Mark Brown)

Vishwaroop A (2):
  spi: add new_device/delete_device sysfs interface
  docs: spi: add documentation for userspace device instantiation

 .../ABI/testing/sysfs-class-spi-master        |  34 +++
 Documentation/spi/index.rst                   |   1 +
 Documentation/spi/instantiating-devices.rst   |  88 ++++++++
 drivers/spi/spi.c                             | 206 ++++++++++++++++++
 include/linux/spi/spi.h                       |  12 +
 5 files changed, 341 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-spi-master
 create mode 100644 Documentation/spi/instantiating-devices.rst

-- 
2.17.1


             reply	other threads:[~2026-05-04  7:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04  7:40 Vishwaroop A [this message]
2026-05-04  7:40 ` [PATCH v3 1/2] spi: add new_device/delete_device sysfs interface Vishwaroop A
2026-05-05  1:24   ` Mark Brown
2026-05-04  7:40 ` [PATCH v3 2/2] docs: spi: add documentation for userspace device instantiation Vishwaroop A

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=20260504074037.704833-1-va@nvidia.com \
    --to=va@nvidia.com \
    --cc=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=jonathanh@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=smangipudi@nvidia.com \
    --cc=thierry.reding@gmail.com \
    /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