linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugen Hristev <eugen.hristev@microchip.com>
To: <nicolas.ferre@microchip.com>, <ludovic.desroches@microchip.com>,
	<alexandre.belloni@free-electrons.com>,
	<linux-iio@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<jic23@kernel.org>, <linux-input@vger.kernel.org>,
	<dmitry.torokhov@gmail.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Subject: [PATCH 03/14] dt-bindings: iio: add binding support for iio trigger provider/consumer
Date: Fri, 22 Dec 2017 17:07:10 +0200	[thread overview]
Message-ID: <1513955241-10985-4-git-send-email-eugen.hristev@microchip.com> (raw)
In-Reply-To: <1513955241-10985-1-git-send-email-eugen.hristev@microchip.com>

Add bindings for producer/consumer for iio triggers.

Similar with iio channels, the iio triggers can be connected between drivers:
one driver will be a producer by registering iio triggers, and another driver
will connect as a consumer.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 .../devicetree/bindings/iio/iio-bindings.txt       | 52 +++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt
index 68d6f8c..d861f0df 100644
--- a/Documentation/devicetree/bindings/iio/iio-bindings.txt
+++ b/Documentation/devicetree/bindings/iio/iio-bindings.txt
@@ -11,6 +11,10 @@ value of a #io-channel-cells property in the IIO provider node.
 
 [1] http://marc.info/?l=linux-iio&m=135902119507483&w=2
 
+Moreover, the provider can have a set of triggers that can be attached to
+from the consumer drivers.
+
+
 ==IIO providers==
 
 Required properties:
@@ -18,6 +22,11 @@ Required properties:
 		   with a single IIO output and 1 for nodes with multiple
 		   IIO outputs.
 
+Optional properties:
+#io-trigger-cells: Number of cells for the IIO trigger specifier. Typically 0
+		   for nodes with a single IIO trigger and 1 for nodes with
+		   multiple IIO triggers.
+
 Example for a simple configuration with no trigger:
 
 	adc: voltage-sensor@35 {
@@ -26,7 +35,7 @@ Example for a simple configuration with no trigger:
 		#io-channel-cells = <1>;
 	};
 
-Example for a configuration with trigger:
+Example for a configuration with channels provided by trigger:
 
 	adc@35 {
 		compatible = "some-vendor,some-adc";
@@ -42,6 +51,17 @@ Example for a configuration with trigger:
 		};
 	};
 
+Example for a configuration for a trigger provider:
+
+	adc: sensor-with-trigger@35 {
+		compatible = "some-vendor,some-adc";
+		reg = <0x35>;
+		#io-channel-cells = <1>;
+		#io-trigger-cells = <1>;
+		/* other properties */
+	};
+
+
 ==IIO consumers==
 
 Required properties:
@@ -61,16 +81,38 @@ io-channel-ranges:
 		IIO channels from this node. Useful for bus nodes to provide
 		and IIO channel to their children.
 
+io-triggers:	List of phandle and IIO specifier pairs, one pair
+		for each trigger input to the device. Note: if the
+		IIO trigger provider specifies '0' for #io-trigger-cells,
+		then only the phandle portion of the pair will appear.
+
+io-trigger-names:
+		List of IIO trigger input name strings sorted in the same
+		order as the io-triggers property. Consumers drivers
+		will use io-trigger-names to match IIO trigger input names
+		with IIO specifiers.
+
+io-trigger-ranges:
+		Empty property indicating that child nodes can inherit named
+		IIO triggers from this node. Useful for bus nodes to provide
+		IIO triggers to their children.
+
 For example:
 
 	device {
 		io-channels = <&adc 1>, <&ref 0>;
 		io-channel-names = "vcc", "vdd";
+		io-triggers = <&adc 0>, <&adc 1>;
+		io-trigger-names = "continuous", "external";
 	};
 
 This represents a device with two IIO inputs, named "vcc" and "vdd".
 The vcc channel is connected to output 1 of the &adc device, and the
 vdd channel is connected to output 0 of the &ref device.
+The device also connects to two IIO trigger inputs, named "continuous" and
+"external". The continuous trigger is connected to the trigger output 0 of the
+&adc device, and the external trigger is connected to the trigger output 1 of
+the same &adc device.
 
 ==Example==
 
@@ -78,6 +120,7 @@ vdd channel is connected to output 0 of the &ref device.
 		compatible = "maxim,max1139";
 		reg = <0x35>;
 		#io-channel-cells = <1>;
+		#io-trigger-cells = <1>;
 	};
 
 	...
@@ -94,4 +137,11 @@ vdd channel is connected to output 0 of the &ref device.
 		compatible = "some-consumer";
 		io-channels = <&adc 10>, <&adc 11>;
 		io-channel-names = "adc1", "adc2";
+		io-triggers = <&adc 0>;
+	};
+
+	some_other_consumer {
+		compatible = "some-other-consumer";
+		io-triggers = <&adc 1>, <&adc 2>;
+		io-trigger-names = "edge-triggered", "pwm-generated";
 	};
-- 
2.7.4

  parent reply	other threads:[~2017-12-22 15:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 15:07 [PATCH 00/14] iio: triggers: add consumer support Eugen Hristev
2017-12-22 15:07 ` [PATCH 01/14] MAINTAINERS: add sama5d2 resistive touchscreen Eugen Hristev
2017-12-22 15:07 ` [PATCH 02/14] iio: Add channel for Position Eugen Hristev
2017-12-29 16:09   ` Jonathan Cameron
2017-12-22 15:07 ` Eugen Hristev [this message]
2017-12-26 22:35   ` [PATCH 03/14] dt-bindings: iio: add binding support for iio trigger provider/consumer Rob Herring
2017-12-29 17:24     ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 04/14] dt-bindings: input: touchscreen: sama5d2_rts: create bindings Eugen Hristev
2017-12-22 15:07 ` [PATCH 05/14] iio: triggers: add helper function to retrieve trigger Eugen Hristev
2017-12-22 15:07 ` [PATCH 06/14] iio: triggers: expose attach and detach helpers for pollfuncs Eugen Hristev
2017-12-22 15:07 ` [PATCH 07/14] iio: triggers: on pollfunc attach, complete iio_dev if NULL Eugen Hristev
2017-12-29 17:23   ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 08/14] iio: triggers: add private data to pollfuncs Eugen Hristev
2017-12-22 15:07 ` [PATCH 09/14] iio: inkern: triggers: create helpers for OF trigger retrieval Eugen Hristev
2017-12-29 17:20   ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 10/14] iio: adc: at91-sama5d2_adc: force trigger removal on module remove Eugen Hristev
2017-12-29 16:22   ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 11/14] iio: adc: at91-sama5d2_adc: optimize scan index for diff channels Eugen Hristev
2017-12-29 16:24   ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 12/14] iio: adc: at91-sama5d2_adc: support for position and pressure channels Eugen Hristev
2017-12-29 17:02   ` Jonathan Cameron
2018-01-04 15:17     ` Eugen Hristev
2018-01-06 15:05       ` Jonathan Cameron
2018-01-08 14:12         ` Ludovic Desroches
2018-01-14 10:47           ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 13/14] input: touchscreen: sama5d2_rts: SAMA5D2 Resistive touchscreen driver Eugen Hristev
2017-12-22 16:29   ` Philippe Ombredanne
2017-12-26 22:41   ` Rob Herring
2017-12-29 17:16   ` Jonathan Cameron
2017-12-22 15:07 ` [PATCH 14/14] ARM: dts: at91: sama5d2: Add resistive touch device Eugen Hristev
2017-12-22 16:10   ` Alexandre Belloni

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=1513955241-10985-4-git-send-email-eugen.hristev@microchip.com \
    --to=eugen.hristev@microchip.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.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;
as well as URLs for NNTP newsgroup(s).