Skip to contentSkip to conversation

mux: add overview and add to driver-api docs

PATCH In review Peter Rosin 2 participants 6 messages Dec 12, 2017 – Mar 3, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover mux: add overview and add to driver-api docs

Hi!

Changes since v1:
- added a short introductory paragraph to mux.rst
- added an entry in MAINTAINERS.

I forgot to mention that this applies on top of linux-next, I suspect there will be a trivial conflict with an SPDX conversion in mux/core.c on Linus upstream.

Cheers,
Peter

Peter Rosin (2):
mux: core: add a brief overview of the subsystem
docs: add mux docs to the driver-api docs

 Documentation/driver-api/index.rst |  1 +
 Documentation/driver-api/mux.rst   | 25 +++++++++++++++++++++++++
 MAINTAINERS                        |  1 +
 drivers/mux/core.c                 | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 64 insertions(+)
 create mode 100644 Documentation/driver-api/mux.rst
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/2 mux: core: add a brief overview of the subsystem

Preparation for adding the mux subsystem to the driver-api documenation.

---
 drivers/mux/core.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
drivers/mux/core.c +37 -0
index d1271c1ee23c..ccb5479f8a39 100644
@@ -7,6 +7,43 @@
  * Author: Peter Rosin <[email protected]>
  */
 
+/**
+ * DOC: overview
+ *
+ * The multiplexer subsystem uses the following naming:
+ *
+ * - Multiplexer controller: the piece of hardware that changes the
+ *   state of a hardware multiplexer (or indeed, several parallel
+ *   multiplexers).
+ *
+ * - Multiplexer chip: a collection of multiplexer controllers, in a chip.
+ *
+ * - Multiplexer driver: the device driver that interacts with and handles the
+ *   above hardware. The driver has structures representing a mux chip and mux
+ *   controllers.
+ *
+ * - Multiplexer consumer: the driver that needs to manipulate the hardware
+ *   multiplexer.
+ *
+ * The mux subsystem provides a framework for multiplexer drivers that can
+ * be used by other consumer drivers. It has two primary purposes.
+ *
+ * First, when a consumer driver can be used with one of several multiplexers,
+ * depending on hardware configuration, the actual multiplexer is abstracted
+ * away in the mux drivers. The multiplexer consumer driver can be neater
+ * this way.
+ *
+ * Second, when two consumers -- possibly from different subsystems -- compete
+ * for the same mux controller, i.e. when one mux controller muxes more than
+ * one signal, the mux framework provides locking.
+ *
+ * If the mux driver is so special that it will only ever have a single
+ * consumer, and that consumer can really only work with that one mux driver,
+ * the mux framework is not really providing much benefit. It might be a better
+ * idea to simply manipulate the mux hardware directly from the consumer
+ * driver.
+ */
+
 #define pr_fmt(fmt) "mux-core: " fmt
 
 #include <linux/device.h>
Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/2 docs: add mux docs to the driver-api docs

In reply to Peter Rosin

Include both the overview and the more detailed api docs.

---
 Documentation/driver-api/index.rst |  1 +
 Documentation/driver-api/mux.rst   | 25 +++++++++++++++++++++++++
 MAINTAINERS                        |  1 +
 3 files changed, 27 insertions(+)
 create mode 100644 Documentation/driver-api/mux.rst
Documentation/driver-api/index.rst +1 -0
index d17a9876b473..d10b01b2b429 100644
@@ -47,6 +47,7 @@ available subsections can be seen below.
    gpio
    misc_devices
    dmaengine/index
+   mux
 
 .. only::  subproject and html
 
Documentation/driver-api/mux.rst new file +25 -0
new file mode 100644
index 000000000000..48fc5108ff0e
@@ -0,0 +1,25 @@
+Multiplexer Subsystem
+=====================
+
+A multiplexer is a type of device that selects one of many signals and
+forwards this signal to a single output. A variant is a demultiplexer
+that instead forwards a single input to one of many outputs. There are
+also bidirectional variants. All these variants are handled the same
+by the multiplexer subsystem, and can be used to e.g. fan out an I2C
+bus to avoid client device address collisions or to allow converting
+more signals using a single analog to digital converter.
+
+Overview
+--------
+
+.. kernel-doc:: drivers/mux/core.c
+   :doc: overview
+
+Details
+-------
+
+.. kernel-doc:: include/linux/mux/driver.h
+   :internal:
+
+.. kernel-doc:: drivers/mux/core.c
+   :export:
MAINTAINERS +1 -0
index d4fdcb12616c..2c0bbabedca0 100644
@@ -9298,6 +9298,7 @@ M:	Peter Rosin <[email protected]>
 S:	Maintained
 F:	Documentation/ABI/testing/mux/sysfs-class-mux*
 F:	Documentation/devicetree/bindings/mux/
+F:	Documentation/driver-api/mux.rst
 F:	include/linux/dt-bindings/mux/
 F:	include/linux/mux/
 F:	drivers/mux/
Signature · 1 line
2.11.0
maintainer
#3 lore raw
In reply to Peter Rosin
Quoted 7 lines · On Tue, 12 Dec 2017 09:46:31 +0100 Peter Rosin <[email protected]> wrote:

Changes since v1:
- added a short introductory paragraph to mux.rst
- added an entry in MAINTAINERS.

I forgot to mention that this applies on top of linux-next, I suspect there will be a trivial conflict with an SPDX conversion in mux/core.c on Linus upstream.

Sorry, I've had this just sitting here for a bit. Did you want me to take both patches through the docs tree?

Thanks,

jon

#4 lore raw
Quoted 7 lines · Jonathan Corbet
Quoted 4 lines · On Tue, 12 Dec 2017 09:46:31 +0100 Peter Rosin <[email protected]> wrote:

Changes since v1:
- added a short introductory paragraph to mux.rst
- added an entry in MAINTAINERS.

Quoted 6 lines
Quoted 3 lines

I forgot to mention that this applies on top of linux-next, I suspect there will be a trivial conflict with an SPDX conversion in mux/core.c on Linus upstream.

Sorry, I've had this just sitting here for a bit. Did you want me to take both patches through the docs tree?

I think that's going to be easiest, thanks! Let me know if you want me to rebase them to something w/o the SPDX change.

Cheers,
Peter

#5 lore raw
Quoted 12 lines · Peter Rosin
Quoted 11 lines · Jonathan Corbet
Quoted 7 lines · On Tue, 12 Dec 2017 09:46:31 +0100 Peter Rosin <[email protected]> wrote:

Changes since v1:
- added a short introductory paragraph to mux.rst
- added an entry in MAINTAINERS.

I forgot to mention that this applies on top of linux-next, I suspect there will be a trivial conflict with an SPDX conversion in mux/core.c on Linus upstream.

Quoted 5 lines
Quoted 2 lines

Sorry, I've had this just sitting here for a bit. Did you want me to take both patches through the docs tree?

I think that's going to be easiest, thanks! Let me know if you want me to rebase them to something w/o the SPDX change.

Hi,

Gentle ping...

Cheers,
Peter