devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/7] Add Linux Motion Control subsystem
@ 2025-02-27 16:28 David Jander
  2025-02-27 16:28 ` [RFC PATCH 1/7] drivers: Add motion control subsystem David Jander
                   ` (9 more replies)
  0 siblings, 10 replies; 59+ messages in thread
From: David Jander @ 2025-02-27 16:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-iio, Jonathan Corbet, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree, linux-doc, Nuno Sa, Jonathan Cameron,
	Oleksij Rempel, David Jander

Request for comments on: adding the Linux Motion Control subsystem to the
kernel.

The Linux Motion Control subsystem (LMC) is a new kernel subsystem and
associated device drivers for hardware devices that control mechanical
motion. Most often these are different types of motors, but can also be
linear actuators for example.

This subsystem defines a new UAPI for motion devices on the user-space
side, as well as common functionality for hardware device drivers on the
driver side.

The UAPI is based on a ioctl() interface on character devices representing
a specific hardware device. The hardware device can control one or more
actuators (motors), which are identified as channels in the UAPI. It is
possible to execute motions on individual channels, or combined
affecting several selected (or all) channels simutaneously. Examples of
coordinated movements of several channels could be the individual axes
of a 3D printer or CNC machine for example.

On the hardware side, this initial set of patches also includes two drivers
for two different kinds of motors. One is a stepper motor controller
device that containes a ramp generator capable of autonomously executing
controlled motions following a multi-point acceleration profile
(TMC5240), as well as a simple DC motor controller driver that can control
DC motors via a half-bridge or full H-bridge driver such as the TI DRV8873
for example.

Towards the IIO subsystem, LMC supports generating iio trigger events that
fire at certain motion events, such as passing a pre-programmed position or
when reaching the motion target position, depending on the capabilities of
the hardware device. This enables for example triggering an ADC measurement
at a certain position during a movement.

In the future, making use of PREEMPT_RT, even dumb STEP/DIR type stepper
motor controller drivers may be implemented entirely in the kernel,
depending on some characteristics of the hardware (latency jittter,
interrupt latency and CPU speed mainly).

The existence of this subsystem may affect other projects, such as
Linux-CNC and Klipper for example.

This code is already in use controlling machines with up to 16 stepper
motors and up to 4 DC motors simutaneously. Up to this point the UAPI
has shown to be adequate and sufficient. Careful thought has gone into
the UAPI design to make sure it coveres as many use-cases as possible,
while being versioned and extensible in the future, with backwards
compatibility in mind.

David Jander (7):
  drivers: Add motion control subsystem
  motion: Add ADI/Trinamic TMC5240 stepper motor controller
  motion: Add simple-pwm.c PWM based DC motor controller driver
  Documentation: Add Linux Motion Control documentation
  dt-bindings: motion: Add common motion device properties
  dt-bindings: motion: Add adi,tmc5240 bindings
  dt-bindings: motion: Add motion-simple-pwm bindings

 .../bindings/motion/adi,tmc5240.yaml          |   60 +
 .../devicetree/bindings/motion/common.yaml    |   52 +
 .../bindings/motion/motion-simple-pwm.yaml    |   55 +
 Documentation/motion/index.rst                |   18 +
 Documentation/motion/motion-uapi.rst          |  555 ++++++++
 Documentation/subsystem-apis.rst              |    1 +
 MAINTAINERS                                   |   13 +
 drivers/Kconfig                               |    2 +
 drivers/Makefile                              |    2 +
 drivers/motion/Kconfig                        |   42 +
 drivers/motion/Makefile                       |    5 +
 drivers/motion/motion-core.c                  |  823 ++++++++++++
 drivers/motion/motion-core.h                  |  172 +++
 drivers/motion/motion-helpers.c               |  590 +++++++++
 drivers/motion/motion-helpers.h               |   23 +
 drivers/motion/simple-pwm.c                   |  199 +++
 drivers/motion/tmc5240.c                      | 1157 +++++++++++++++++
 include/uapi/linux/motion.h                   |  229 ++++
 18 files changed, 3998 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/motion/adi,tmc5240.yaml
 create mode 100644 Documentation/devicetree/bindings/motion/common.yaml
 create mode 100644 Documentation/devicetree/bindings/motion/motion-simple-pwm.yaml
 create mode 100644 Documentation/motion/index.rst
 create mode 100644 Documentation/motion/motion-uapi.rst
 create mode 100644 drivers/motion/Kconfig
 create mode 100644 drivers/motion/Makefile
 create mode 100644 drivers/motion/motion-core.c
 create mode 100644 drivers/motion/motion-core.h
 create mode 100644 drivers/motion/motion-helpers.c
 create mode 100644 drivers/motion/motion-helpers.h
 create mode 100644 drivers/motion/simple-pwm.c
 create mode 100644 drivers/motion/tmc5240.c
 create mode 100644 include/uapi/linux/motion.h

-- 
2.47.2


^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2025-03-10  8:45 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 16:28 [RFC PATCH 0/7] Add Linux Motion Control subsystem David Jander
2025-02-27 16:28 ` [RFC PATCH 1/7] drivers: Add motion control subsystem David Jander
2025-02-28 16:44   ` Uwe Kleine-König
2025-03-05 15:40     ` David Jander
2025-03-05 23:21       ` Uwe Kleine-König
2025-03-06  7:18         ` Greg Kroah-Hartman
2025-03-06  8:20           ` David Jander
2025-03-06  9:03             ` Greg Kroah-Hartman
2025-03-06  9:34               ` David Jander
2025-03-06 13:39                 ` Greg Kroah-Hartman
2025-03-06 14:25                   ` David Jander
2025-03-06 14:54                     ` Greg Kroah-Hartman
2025-03-06  9:25         ` David Jander
2025-03-09 17:32           ` Jonathan Cameron
2025-03-10  8:45             ` David Jander
2025-02-28 22:36   ` David Lechner
2025-03-03  8:36     ` David Jander
2025-03-03 11:01       ` Pavel Pisa
2025-03-03 16:04         ` David Jander
2025-02-27 16:28 ` [RFC PATCH 2/7] motion: Add ADI/Trinamic TMC5240 stepper motor controller David Jander
2025-02-27 16:28 ` [RFC PATCH 3/7] motion: Add simple-pwm.c PWM based DC motor controller driver David Jander
2025-02-27 16:28 ` [RFC PATCH 4/7] Documentation: Add Linux Motion Control documentation David Jander
2025-02-27 16:37   ` Jonathan Corbet
2025-02-28 13:02     ` David Jander
2025-02-28 14:42       ` Jonathan Corbet
2025-02-28 15:06         ` David Jander
2025-02-27 16:28 ` [RFC PATCH 5/7] dt-bindings: motion: Add common motion device properties David Jander
2025-02-28  7:06   ` Krzysztof Kozlowski
2025-02-28  7:13   ` Krzysztof Kozlowski
2025-02-27 16:28 ` [RFC PATCH 6/7] dt-bindings: motion: Add adi,tmc5240 bindings David Jander
2025-02-28  7:11   ` Krzysztof Kozlowski
2025-02-28  8:48     ` David Jander
2025-02-28  9:35       ` Krzysztof Kozlowski
2025-02-28  9:51         ` David Jander
2025-02-28 14:01           ` Krzysztof Kozlowski
2025-02-28 22:38   ` David Lechner
2025-03-03 11:22     ` David Jander
2025-03-03 12:28       ` David Lechner
2025-03-03 13:18         ` David Jander
2025-02-27 16:28 ` [RFC PATCH 7/7] dt-bindings: motion: Add motion-simple-pwm bindings David Jander
2025-02-27 17:38   ` Rob Herring (Arm)
2025-02-28  7:12   ` Krzysztof Kozlowski
2025-02-28  9:22     ` David Jander
2025-02-28  9:37       ` Krzysztof Kozlowski
2025-02-28 10:09         ` David Jander
2025-02-28 15:18           ` Uwe Kleine-König
2025-03-03 10:53             ` Maud Spierings
2025-03-03 11:40             ` David Jander
2025-03-03 14:18               ` Krzysztof Kozlowski
2025-03-03 16:09                 ` David Jander
2025-02-28 22:41   ` David Lechner
2025-03-03 12:54     ` David Jander
2025-02-28  9:34 ` [RFC PATCH 0/7] Add Linux Motion Control subsystem Pavel Pisa
2025-02-28  9:35 ` Pavel Pisa
2025-02-28 11:57   ` David Jander
2025-02-28 15:23     ` Pavel Pisa
2025-03-03 10:45       ` David Jander
2025-02-28 22:36 ` David Lechner
2025-03-03  8:28   ` David Jander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).