All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC
@ 2017-01-30 13:57 ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard

STM32 ADC, can use GPIOs configured as EXTI line (external interrupt)
as trigger source for conversions.
This patchset is based on latest IIO testing branch, and adds support
for EXTi GPIO triggers in IIO.
It also adds a dt option to configure default trigger polarity in
STM32 ADC driver.

Fabrice Gasnier (5):
  Documentation: dt: iio: document stm32 adc trigger polarity
  iio: adc: stm32: add dt option to set default trigger polarity
  Documentation: dt: iio: document stm32 exti trigger
  iio: trigger: add support for STM32 EXTI triggers
  iio: adc: stm32: add exti11 gpio trigger source

 .../devicetree/bindings/iio/adc/st,stm32-adc.txt   |   3 +
 .../bindings/iio/trigger/st,stm32-exti-trigger.txt |  17 +++
 drivers/iio/adc/stm32-adc.c                        |  14 +++
 drivers/iio/trigger/Kconfig                        |  10 ++
 drivers/iio/trigger/Makefile                       |   1 +
 drivers/iio/trigger/stm32-exti-trigger.c           | 124 +++++++++++++++++++++
 include/linux/iio/trigger/stm32-exti-trigger.h     |  26 +++++
 7 files changed, 195 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
 create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
 create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h

-- 
1.9.1

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

* [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC
@ 2017-01-30 13:57 ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: mark.rutland, benjamin.gaignard, lars, alexandre.torgue,
	linux-iio, pmeerw, mcoquelin.stm32, knaack.h, fabrice.gasnier,
	benjamin.gaignard

STM32 ADC, can use GPIOs configured as EXTI line (external interrupt)
as trigger source for conversions.
This patchset is based on latest IIO testing branch, and adds support
for EXTi GPIO triggers in IIO.
It also adds a dt option to configure default trigger polarity in
STM32 ADC driver.

Fabrice Gasnier (5):
  Documentation: dt: iio: document stm32 adc trigger polarity
  iio: adc: stm32: add dt option to set default trigger polarity
  Documentation: dt: iio: document stm32 exti trigger
  iio: trigger: add support for STM32 EXTI triggers
  iio: adc: stm32: add exti11 gpio trigger source

 .../devicetree/bindings/iio/adc/st,stm32-adc.txt   |   3 +
 .../bindings/iio/trigger/st,stm32-exti-trigger.txt |  17 +++
 drivers/iio/adc/stm32-adc.c                        |  14 +++
 drivers/iio/trigger/Kconfig                        |  10 ++
 drivers/iio/trigger/Makefile                       |   1 +
 drivers/iio/trigger/stm32-exti-trigger.c           | 124 +++++++++++++++++++++
 include/linux/iio/trigger/stm32-exti-trigger.h     |  26 +++++
 7 files changed, 195 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
 create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
 create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h

-- 
1.9.1

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

* [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC
@ 2017-01-30 13:57 ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

STM32 ADC, can use GPIOs configured as EXTI line (external interrupt)
as trigger source for conversions.
This patchset is based on latest IIO testing branch, and adds support
for EXTi GPIO triggers in IIO.
It also adds a dt option to configure default trigger polarity in
STM32 ADC driver.

Fabrice Gasnier (5):
  Documentation: dt: iio: document stm32 adc trigger polarity
  iio: adc: stm32: add dt option to set default trigger polarity
  Documentation: dt: iio: document stm32 exti trigger
  iio: trigger: add support for STM32 EXTI triggers
  iio: adc: stm32: add exti11 gpio trigger source

 .../devicetree/bindings/iio/adc/st,stm32-adc.txt   |   3 +
 .../bindings/iio/trigger/st,stm32-exti-trigger.txt |  17 +++
 drivers/iio/adc/stm32-adc.c                        |  14 +++
 drivers/iio/trigger/Kconfig                        |  10 ++
 drivers/iio/trigger/Makefile                       |   1 +
 drivers/iio/trigger/stm32-exti-trigger.c           | 124 +++++++++++++++++++++
 include/linux/iio/trigger/stm32-exti-trigger.h     |  26 +++++
 7 files changed, 195 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
 create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
 create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h

-- 
1.9.1

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

* [PATCH 1/5] Documentation: dt: iio: document stm32 adc trigger polarity
  2017-01-30 13:57 ` Fabrice Gasnier
  (?)
@ 2017-01-30 13:57   ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard

STM32 ADC trigger polarity can be set to either rising, falling
or both edges. Allow to configure it from dt.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
index 5dfc88e..6c6d968 100644
--- a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
@@ -57,6 +57,8 @@ Optional properties:
 - dmas: Phandle to dma channel for this ADC instance.
   See ../../dma/dma.txt for details.
 - dma-names: Must be "rx" when dmas property is being used.
+- st,trigger-polarity: Must be 0 (default), 1 or 2 to set default trigger
+  polarity to respectively "rising-edge", "falling-edge" or "both-edges".
 
 Example:
 	adc: adc@40012000 {
@@ -84,6 +86,7 @@ Example:
 			st,adc-channels = <8>;
 			dmas = <&dma2 0 0 0x400 0x0>;
 			dma-names = "rx";
+			st,trigger-polarity = <1>;
 		};
 		...
 		other adc child nodes follow...
-- 
1.9.1

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

* [PATCH 1/5] Documentation: dt: iio: document stm32 adc trigger polarity
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: mark.rutland, benjamin.gaignard, lars, alexandre.torgue,
	linux-iio, pmeerw, mcoquelin.stm32, knaack.h, fabrice.gasnier,
	benjamin.gaignard

STM32 ADC trigger polarity can be set to either rising, falling
or both edges. Allow to configure it from dt.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
index 5dfc88e..6c6d968 100644
--- a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
@@ -57,6 +57,8 @@ Optional properties:
 - dmas: Phandle to dma channel for this ADC instance.
   See ../../dma/dma.txt for details.
 - dma-names: Must be "rx" when dmas property is being used.
+- st,trigger-polarity: Must be 0 (default), 1 or 2 to set default trigger
+  polarity to respectively "rising-edge", "falling-edge" or "both-edges".
 
 Example:
 	adc: adc@40012000 {
@@ -84,6 +86,7 @@ Example:
 			st,adc-channels = <8>;
 			dmas = <&dma2 0 0 0x400 0x0>;
 			dma-names = "rx";
+			st,trigger-polarity = <1>;
 		};
 		...
 		other adc child nodes follow...
-- 
1.9.1

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

* [PATCH 1/5] Documentation: dt: iio: document stm32 adc trigger polarity
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

STM32 ADC trigger polarity can be set to either rising, falling
or both edges. Allow to configure it from dt.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
index 5dfc88e..6c6d968 100644
--- a/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
+++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
@@ -57,6 +57,8 @@ Optional properties:
 - dmas: Phandle to dma channel for this ADC instance.
   See ../../dma/dma.txt for details.
 - dma-names: Must be "rx" when dmas property is being used.
+- st,trigger-polarity: Must be 0 (default), 1 or 2 to set default trigger
+  polarity to respectively "rising-edge", "falling-edge" or "both-edges".
 
 Example:
 	adc: adc at 40012000 {
@@ -84,6 +86,7 @@ Example:
 			st,adc-channels = <8>;
 			dmas = <&dma2 0 0 0x400 0x0>;
 			dma-names = "rx";
+			st,trigger-polarity = <1>;
 		};
 		...
 		other adc child nodes follow...
-- 
1.9.1

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

* [PATCH 2/5] iio: adc: stm32: add dt option to set default trigger polarity
  2017-01-30 13:57 ` Fabrice Gasnier
  (?)
@ 2017-01-30 13:57   ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard

STM32 ADC trigger polarity can be set to either rising, falling
or both edges. Add dt option to configure it.
Note: default value may be overridden later via trigger_polarity
sysfs attribute.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 9b49a6ad..be0e457 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -997,6 +997,13 @@ static int stm32_adc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	of_property_read_u32(pdev->dev.of_node, "st,trigger-polarity",
+			     &adc->trigger_polarity);
+	if (adc->trigger_polarity >= ARRAY_SIZE(stm32_trig_pol_items)) {
+		dev_err(&pdev->dev, "Invalid st,trigger-polarity property\n");
+		return -EINVAL;
+	}
+
 	adc->irq = platform_get_irq(pdev, 0);
 	if (adc->irq < 0) {
 		dev_err(&pdev->dev, "failed to get irq\n");
-- 
1.9.1

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

* [PATCH 2/5] iio: adc: stm32: add dt option to set default trigger polarity
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: mark.rutland, benjamin.gaignard, lars, alexandre.torgue,
	linux-iio, pmeerw, mcoquelin.stm32, knaack.h, fabrice.gasnier,
	benjamin.gaignard

STM32 ADC trigger polarity can be set to either rising, falling
or both edges. Add dt option to configure it.
Note: default value may be overridden later via trigger_polarity
sysfs attribute.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 9b49a6ad..be0e457 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -997,6 +997,13 @@ static int stm32_adc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	of_property_read_u32(pdev->dev.of_node, "st,trigger-polarity",
+			     &adc->trigger_polarity);
+	if (adc->trigger_polarity >= ARRAY_SIZE(stm32_trig_pol_items)) {
+		dev_err(&pdev->dev, "Invalid st,trigger-polarity property\n");
+		return -EINVAL;
+	}
+
 	adc->irq = platform_get_irq(pdev, 0);
 	if (adc->irq < 0) {
 		dev_err(&pdev->dev, "failed to get irq\n");
-- 
1.9.1

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

* [PATCH 2/5] iio: adc: stm32: add dt option to set default trigger polarity
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

STM32 ADC trigger polarity can be set to either rising, falling
or both edges. Add dt option to configure it.
Note: default value may be overridden later via trigger_polarity
sysfs attribute.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 9b49a6ad..be0e457 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -997,6 +997,13 @@ static int stm32_adc_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	of_property_read_u32(pdev->dev.of_node, "st,trigger-polarity",
+			     &adc->trigger_polarity);
+	if (adc->trigger_polarity >= ARRAY_SIZE(stm32_trig_pol_items)) {
+		dev_err(&pdev->dev, "Invalid st,trigger-polarity property\n");
+		return -EINVAL;
+	}
+
 	adc->irq = platform_get_irq(pdev, 0);
 	if (adc->irq < 0) {
 		dev_err(&pdev->dev, "failed to get irq\n");
-- 
1.9.1

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
  2017-01-30 13:57 ` Fabrice Gasnier
  (?)
@ 2017-01-30 13:57   ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard

Add dt documentation for st,stm32-exti-trigger.
EXTi gpio signal can be routed internally as trigger source for various
IPs (e.g. for ADC or DAC conversions).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt

diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
new file mode 100644
index 0000000..ebf2645
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
@@ -0,0 +1,17 @@
+STMicroelectronics STM32 EXTI trigger bindings
+
+EXTi gpio signal can be routed internally as trigger source for various
+IPs (e.g. for ADC or DAC conversions).
+
+Contents of a stm32 exti trigger root node:
+-------------------------------------------
+Required properties:
+- compatible: Should be "st,stm32-exti-trigger"
+- extiN-gpio: optional gpio line that may be used as external trigger source
+  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
+
+Example:
+	triggers {
+		compatible = "st,stm32-exti-trigger";
+		exti11-gpio=<&gpioa 11 0>;
+	};
-- 
1.9.1

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: mark.rutland, benjamin.gaignard, lars, alexandre.torgue,
	linux-iio, pmeerw, mcoquelin.stm32, knaack.h, fabrice.gasnier,
	benjamin.gaignard

Add dt documentation for st,stm32-exti-trigger.
EXTi gpio signal can be routed internally as trigger source for various
IPs (e.g. for ADC or DAC conversions).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt

diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
new file mode 100644
index 0000000..ebf2645
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
@@ -0,0 +1,17 @@
+STMicroelectronics STM32 EXTI trigger bindings
+
+EXTi gpio signal can be routed internally as trigger source for various
+IPs (e.g. for ADC or DAC conversions).
+
+Contents of a stm32 exti trigger root node:
+-------------------------------------------
+Required properties:
+- compatible: Should be "st,stm32-exti-trigger"
+- extiN-gpio: optional gpio line that may be used as external trigger source
+  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
+
+Example:
+	triggers {
+		compatible = "st,stm32-exti-trigger";
+		exti11-gpio=<&gpioa 11 0>;
+	};
-- 
1.9.1

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

Add dt documentation for st,stm32-exti-trigger.
EXTi gpio signal can be routed internally as trigger source for various
IPs (e.g. for ADC or DAC conversions).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt

diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
new file mode 100644
index 0000000..ebf2645
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
@@ -0,0 +1,17 @@
+STMicroelectronics STM32 EXTI trigger bindings
+
+EXTi gpio signal can be routed internally as trigger source for various
+IPs (e.g. for ADC or DAC conversions).
+
+Contents of a stm32 exti trigger root node:
+-------------------------------------------
+Required properties:
+- compatible: Should be "st,stm32-exti-trigger"
+- extiN-gpio: optional gpio line that may be used as external trigger source
+  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
+
+Example:
+	triggers {
+		compatible = "st,stm32-exti-trigger";
+		exti11-gpio=<&gpioa 11 0>;
+	};
-- 
1.9.1

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

* [PATCH 4/5] iio: trigger: add support for STM32 EXTI triggers
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard

EXTi[0..15] gpio signal can be routed internally as trigger source for
ADC or DAC conversions. Configure them as interrupts to configure
trigger path in HW.

Note: interrupt handler isn't required here, and corresponding interrupt
can be kept masked at exti controller level.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/trigger/Kconfig                    |  10 ++
 drivers/iio/trigger/Makefile                   |   1 +
 drivers/iio/trigger/stm32-exti-trigger.c       | 124 +++++++++++++++++++++++++
 include/linux/iio/trigger/stm32-exti-trigger.h |  26 ++++++
 4 files changed, 161 insertions(+)
 create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
 create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h

diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
index e4d4e63..b0c5104 100644
--- a/drivers/iio/trigger/Kconfig
+++ b/drivers/iio/trigger/Kconfig
@@ -24,6 +24,16 @@ config IIO_INTERRUPT_TRIGGER
 	  To compile this driver as a module, choose M here: the
 	  module will be called iio-trig-interrupt.
 
+config IIO_STM32_EXTI_TRIGGER
+	tristate "STM32 EXTI Trigger"
+	depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
+	help
+	  Select this option to enable STM32 EXTI Triggers on GPIO. These
+	  maybe used then on other STM32 IPs like ADC or DAC.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called stm32-exti-trigger.
+
 config IIO_STM32_TIMER_TRIGGER
 	tristate "STM32 Timer Trigger"
 	depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
diff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile
index 5c4ecd3..12d5d72 100644
--- a/drivers/iio/trigger/Makefile
+++ b/drivers/iio/trigger/Makefile
@@ -6,6 +6,7 @@
 
 obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o
 obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o
+obj-$(CONFIG_IIO_STM32_EXTI_TRIGGER) += stm32-exti-trigger.o
 obj-$(CONFIG_IIO_STM32_TIMER_TRIGGER) += stm32-timer-trigger.o
 obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o
 obj-$(CONFIG_IIO_TIGHTLOOP_TRIGGER) += iio-trig-loop.o
diff --git a/drivers/iio/trigger/stm32-exti-trigger.c b/drivers/iio/trigger/stm32-exti-trigger.c
new file mode 100644
index 0000000..2a3ec3c
--- /dev/null
+++ b/drivers/iio/trigger/stm32-exti-trigger.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
+ *
+ * License type: GPLv2
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+/* STM32 has up to 16 EXTI triggers on GPIOs */
+#define STM32_MAX_EXTI_TRIGGER	16
+
+static const struct iio_trigger_ops exti_trigger_ops = {
+	.owner = THIS_MODULE,
+};
+
+bool is_stm32_exti_trigger(struct iio_trigger *trig)
+{
+	return (trig->ops == &exti_trigger_ops);
+}
+EXPORT_SYMBOL(is_stm32_exti_trigger);
+
+static irqreturn_t stm32_exti_trigger_handler(int irq, void *data)
+{
+	/* Exti handler shouldn't be invoked, and isn't used */
+	return IRQ_HANDLED;
+}
+
+static int stm32_exti_trigger_probe(struct platform_device *pdev)
+{
+	int irq, ret;
+	char name[8];
+	struct gpio_desc *gpio;
+	struct iio_trigger *trig;
+	unsigned int i;
+
+	for (i = 0; i < STM32_MAX_EXTI_TRIGGER; i++) {
+		snprintf(name, sizeof(name), "exti%d", i);
+
+		gpio = devm_gpiod_get_optional(&pdev->dev, name, GPIOD_IN);
+		if (IS_ERR_OR_NULL(gpio)) {
+			if (IS_ERR(gpio)) {
+				dev_err(&pdev->dev, "gpio %s get error %ld\n",
+					name, PTR_ERR(gpio));
+				return PTR_ERR(gpio);
+			}
+			dev_dbg(&pdev->dev, "No %s gpio\n", name);
+			continue;
+		}
+
+		irq = gpiod_to_irq(gpio);
+		if (irq < 0) {
+			dev_err(&pdev->dev, "gpio %d to irq failed\n", i);
+			return irq;
+		}
+
+		ret = devm_request_irq(&pdev->dev, irq,
+				       stm32_exti_trigger_handler,
+				       0, dev_name(&pdev->dev), pdev);
+		if (ret) {
+			dev_err(&pdev->dev, "request IRQ %d failed\n", irq);
+			return ret;
+		}
+
+		/*
+		 * gpios are configured as interrupts, so exti trigger path is
+		 * configured in HW, and can now be used as external trigger
+		 * source by other IPs. But getting interrupts when trigger
+		 * occurs is unused here, so mask irq on exti controller by
+		 * default.
+		 */
+		disable_irq(irq);
+
+		trig = devm_iio_trigger_alloc(&pdev->dev, "%s", name);
+		if (!trig)
+			return -ENOMEM;
+
+		trig->dev.parent = &pdev->dev;
+		trig->ops = &exti_trigger_ops;
+
+		ret = devm_iio_trigger_register(&pdev->dev, trig);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static const struct of_device_id stm32_exti_trigger_of_match[] = {
+	{ .compatible = "st,stm32-exti-trigger" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, stm32_exti_trigger_of_match);
+
+static struct platform_driver stm32_exti_trigger_driver = {
+	.probe = stm32_exti_trigger_probe,
+	.driver = {
+		.name = "stm32-exti-trigger",
+		.of_match_table = stm32_exti_trigger_of_match,
+	},
+};
+module_platform_driver(stm32_exti_trigger_driver);
+
+MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
+MODULE_DESCRIPTION("STMicroelectronics STM32 EXTI-GPIO IIO trigger driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:stm32-exti-trigger");
diff --git a/include/linux/iio/trigger/stm32-exti-trigger.h b/include/linux/iio/trigger/stm32-exti-trigger.h
new file mode 100644
index 0000000..157ae58
--- /dev/null
+++ b/include/linux/iio/trigger/stm32-exti-trigger.h
@@ -0,0 +1,26 @@
+/*
+ * This file is part of STM32 EXTI Trigger driver
+ *
+ * Copyright (C) STMicroelectronics 2017
+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
+ *
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STM32_EXTI_TRIGGER_H_
+#define _STM32_EXTI_TRIGGER_H_
+
+#include <linux/stddef.h>
+
+#define STM32_EXTI(n)		"exti"#n
+
+#if IS_ENABLED(CONFIG_IIO_STM32_EXTI_TRIGGER)
+bool is_stm32_exti_trigger(struct iio_trigger *trig);
+#else
+static inline bool is_stm32_exti_trigger(struct iio_trigger *trig)
+{
+	return false;
+}
+#endif
+
+#endif
-- 
1.9.1

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

* [PATCH 4/5] iio: trigger: add support for STM32 EXTI triggers
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw,
	knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	fabrice.gasnier-qxv4g6HH51o,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	benjamin.gaignard-qxv4g6HH51o

EXTi[0..15] gpio signal can be routed internally as trigger source for
ADC or DAC conversions. Configure them as interrupts to configure
trigger path in HW.

Note: interrupt handler isn't required here, and corresponding interrupt
can be kept masked at exti controller level.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
---
 drivers/iio/trigger/Kconfig                    |  10 ++
 drivers/iio/trigger/Makefile                   |   1 +
 drivers/iio/trigger/stm32-exti-trigger.c       | 124 +++++++++++++++++++++++++
 include/linux/iio/trigger/stm32-exti-trigger.h |  26 ++++++
 4 files changed, 161 insertions(+)
 create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
 create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h

diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
index e4d4e63..b0c5104 100644
--- a/drivers/iio/trigger/Kconfig
+++ b/drivers/iio/trigger/Kconfig
@@ -24,6 +24,16 @@ config IIO_INTERRUPT_TRIGGER
 	  To compile this driver as a module, choose M here: the
 	  module will be called iio-trig-interrupt.
 
+config IIO_STM32_EXTI_TRIGGER
+	tristate "STM32 EXTI Trigger"
+	depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
+	help
+	  Select this option to enable STM32 EXTI Triggers on GPIO. These
+	  maybe used then on other STM32 IPs like ADC or DAC.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called stm32-exti-trigger.
+
 config IIO_STM32_TIMER_TRIGGER
 	tristate "STM32 Timer Trigger"
 	depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
diff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile
index 5c4ecd3..12d5d72 100644
--- a/drivers/iio/trigger/Makefile
+++ b/drivers/iio/trigger/Makefile
@@ -6,6 +6,7 @@
 
 obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o
 obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o
+obj-$(CONFIG_IIO_STM32_EXTI_TRIGGER) += stm32-exti-trigger.o
 obj-$(CONFIG_IIO_STM32_TIMER_TRIGGER) += stm32-timer-trigger.o
 obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o
 obj-$(CONFIG_IIO_TIGHTLOOP_TRIGGER) += iio-trig-loop.o
diff --git a/drivers/iio/trigger/stm32-exti-trigger.c b/drivers/iio/trigger/stm32-exti-trigger.c
new file mode 100644
index 0000000..2a3ec3c
--- /dev/null
+++ b/drivers/iio/trigger/stm32-exti-trigger.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>.
+ *
+ * License type: GPLv2
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+/* STM32 has up to 16 EXTI triggers on GPIOs */
+#define STM32_MAX_EXTI_TRIGGER	16
+
+static const struct iio_trigger_ops exti_trigger_ops = {
+	.owner = THIS_MODULE,
+};
+
+bool is_stm32_exti_trigger(struct iio_trigger *trig)
+{
+	return (trig->ops == &exti_trigger_ops);
+}
+EXPORT_SYMBOL(is_stm32_exti_trigger);
+
+static irqreturn_t stm32_exti_trigger_handler(int irq, void *data)
+{
+	/* Exti handler shouldn't be invoked, and isn't used */
+	return IRQ_HANDLED;
+}
+
+static int stm32_exti_trigger_probe(struct platform_device *pdev)
+{
+	int irq, ret;
+	char name[8];
+	struct gpio_desc *gpio;
+	struct iio_trigger *trig;
+	unsigned int i;
+
+	for (i = 0; i < STM32_MAX_EXTI_TRIGGER; i++) {
+		snprintf(name, sizeof(name), "exti%d", i);
+
+		gpio = devm_gpiod_get_optional(&pdev->dev, name, GPIOD_IN);
+		if (IS_ERR_OR_NULL(gpio)) {
+			if (IS_ERR(gpio)) {
+				dev_err(&pdev->dev, "gpio %s get error %ld\n",
+					name, PTR_ERR(gpio));
+				return PTR_ERR(gpio);
+			}
+			dev_dbg(&pdev->dev, "No %s gpio\n", name);
+			continue;
+		}
+
+		irq = gpiod_to_irq(gpio);
+		if (irq < 0) {
+			dev_err(&pdev->dev, "gpio %d to irq failed\n", i);
+			return irq;
+		}
+
+		ret = devm_request_irq(&pdev->dev, irq,
+				       stm32_exti_trigger_handler,
+				       0, dev_name(&pdev->dev), pdev);
+		if (ret) {
+			dev_err(&pdev->dev, "request IRQ %d failed\n", irq);
+			return ret;
+		}
+
+		/*
+		 * gpios are configured as interrupts, so exti trigger path is
+		 * configured in HW, and can now be used as external trigger
+		 * source by other IPs. But getting interrupts when trigger
+		 * occurs is unused here, so mask irq on exti controller by
+		 * default.
+		 */
+		disable_irq(irq);
+
+		trig = devm_iio_trigger_alloc(&pdev->dev, "%s", name);
+		if (!trig)
+			return -ENOMEM;
+
+		trig->dev.parent = &pdev->dev;
+		trig->ops = &exti_trigger_ops;
+
+		ret = devm_iio_trigger_register(&pdev->dev, trig);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static const struct of_device_id stm32_exti_trigger_of_match[] = {
+	{ .compatible = "st,stm32-exti-trigger" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, stm32_exti_trigger_of_match);
+
+static struct platform_driver stm32_exti_trigger_driver = {
+	.probe = stm32_exti_trigger_probe,
+	.driver = {
+		.name = "stm32-exti-trigger",
+		.of_match_table = stm32_exti_trigger_of_match,
+	},
+};
+module_platform_driver(stm32_exti_trigger_driver);
+
+MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>");
+MODULE_DESCRIPTION("STMicroelectronics STM32 EXTI-GPIO IIO trigger driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:stm32-exti-trigger");
diff --git a/include/linux/iio/trigger/stm32-exti-trigger.h b/include/linux/iio/trigger/stm32-exti-trigger.h
new file mode 100644
index 0000000..157ae58
--- /dev/null
+++ b/include/linux/iio/trigger/stm32-exti-trigger.h
@@ -0,0 +1,26 @@
+/*
+ * This file is part of STM32 EXTI Trigger driver
+ *
+ * Copyright (C) STMicroelectronics 2017
+ * Author: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>.
+ *
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STM32_EXTI_TRIGGER_H_
+#define _STM32_EXTI_TRIGGER_H_
+
+#include <linux/stddef.h>
+
+#define STM32_EXTI(n)		"exti"#n
+
+#if IS_ENABLED(CONFIG_IIO_STM32_EXTI_TRIGGER)
+bool is_stm32_exti_trigger(struct iio_trigger *trig);
+#else
+static inline bool is_stm32_exti_trigger(struct iio_trigger *trig)
+{
+	return false;
+}
+#endif
+
+#endif
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 4/5] iio: trigger: add support for STM32 EXTI triggers
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

EXTi[0..15] gpio signal can be routed internally as trigger source for
ADC or DAC conversions. Configure them as interrupts to configure
trigger path in HW.

Note: interrupt handler isn't required here, and corresponding interrupt
can be kept masked at exti controller level.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/trigger/Kconfig                    |  10 ++
 drivers/iio/trigger/Makefile                   |   1 +
 drivers/iio/trigger/stm32-exti-trigger.c       | 124 +++++++++++++++++++++++++
 include/linux/iio/trigger/stm32-exti-trigger.h |  26 ++++++
 4 files changed, 161 insertions(+)
 create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
 create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h

diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
index e4d4e63..b0c5104 100644
--- a/drivers/iio/trigger/Kconfig
+++ b/drivers/iio/trigger/Kconfig
@@ -24,6 +24,16 @@ config IIO_INTERRUPT_TRIGGER
 	  To compile this driver as a module, choose M here: the
 	  module will be called iio-trig-interrupt.
 
+config IIO_STM32_EXTI_TRIGGER
+	tristate "STM32 EXTI Trigger"
+	depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
+	help
+	  Select this option to enable STM32 EXTI Triggers on GPIO. These
+	  maybe used then on other STM32 IPs like ADC or DAC.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called stm32-exti-trigger.
+
 config IIO_STM32_TIMER_TRIGGER
 	tristate "STM32 Timer Trigger"
 	depends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST
diff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile
index 5c4ecd3..12d5d72 100644
--- a/drivers/iio/trigger/Makefile
+++ b/drivers/iio/trigger/Makefile
@@ -6,6 +6,7 @@
 
 obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o
 obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o
+obj-$(CONFIG_IIO_STM32_EXTI_TRIGGER) += stm32-exti-trigger.o
 obj-$(CONFIG_IIO_STM32_TIMER_TRIGGER) += stm32-timer-trigger.o
 obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o
 obj-$(CONFIG_IIO_TIGHTLOOP_TRIGGER) += iio-trig-loop.o
diff --git a/drivers/iio/trigger/stm32-exti-trigger.c b/drivers/iio/trigger/stm32-exti-trigger.c
new file mode 100644
index 0000000..2a3ec3c
--- /dev/null
+++ b/drivers/iio/trigger/stm32-exti-trigger.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
+ *
+ * License type: GPLv2
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/gpio/consumer.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+/* STM32 has up to 16 EXTI triggers on GPIOs */
+#define STM32_MAX_EXTI_TRIGGER	16
+
+static const struct iio_trigger_ops exti_trigger_ops = {
+	.owner = THIS_MODULE,
+};
+
+bool is_stm32_exti_trigger(struct iio_trigger *trig)
+{
+	return (trig->ops == &exti_trigger_ops);
+}
+EXPORT_SYMBOL(is_stm32_exti_trigger);
+
+static irqreturn_t stm32_exti_trigger_handler(int irq, void *data)
+{
+	/* Exti handler shouldn't be invoked, and isn't used */
+	return IRQ_HANDLED;
+}
+
+static int stm32_exti_trigger_probe(struct platform_device *pdev)
+{
+	int irq, ret;
+	char name[8];
+	struct gpio_desc *gpio;
+	struct iio_trigger *trig;
+	unsigned int i;
+
+	for (i = 0; i < STM32_MAX_EXTI_TRIGGER; i++) {
+		snprintf(name, sizeof(name), "exti%d", i);
+
+		gpio = devm_gpiod_get_optional(&pdev->dev, name, GPIOD_IN);
+		if (IS_ERR_OR_NULL(gpio)) {
+			if (IS_ERR(gpio)) {
+				dev_err(&pdev->dev, "gpio %s get error %ld\n",
+					name, PTR_ERR(gpio));
+				return PTR_ERR(gpio);
+			}
+			dev_dbg(&pdev->dev, "No %s gpio\n", name);
+			continue;
+		}
+
+		irq = gpiod_to_irq(gpio);
+		if (irq < 0) {
+			dev_err(&pdev->dev, "gpio %d to irq failed\n", i);
+			return irq;
+		}
+
+		ret = devm_request_irq(&pdev->dev, irq,
+				       stm32_exti_trigger_handler,
+				       0, dev_name(&pdev->dev), pdev);
+		if (ret) {
+			dev_err(&pdev->dev, "request IRQ %d failed\n", irq);
+			return ret;
+		}
+
+		/*
+		 * gpios are configured as interrupts, so exti trigger path is
+		 * configured in HW, and can now be used as external trigger
+		 * source by other IPs. But getting interrupts when trigger
+		 * occurs is unused here, so mask irq on exti controller by
+		 * default.
+		 */
+		disable_irq(irq);
+
+		trig = devm_iio_trigger_alloc(&pdev->dev, "%s", name);
+		if (!trig)
+			return -ENOMEM;
+
+		trig->dev.parent = &pdev->dev;
+		trig->ops = &exti_trigger_ops;
+
+		ret = devm_iio_trigger_register(&pdev->dev, trig);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+
+static const struct of_device_id stm32_exti_trigger_of_match[] = {
+	{ .compatible = "st,stm32-exti-trigger" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, stm32_exti_trigger_of_match);
+
+static struct platform_driver stm32_exti_trigger_driver = {
+	.probe = stm32_exti_trigger_probe,
+	.driver = {
+		.name = "stm32-exti-trigger",
+		.of_match_table = stm32_exti_trigger_of_match,
+	},
+};
+module_platform_driver(stm32_exti_trigger_driver);
+
+MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
+MODULE_DESCRIPTION("STMicroelectronics STM32 EXTI-GPIO IIO trigger driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:stm32-exti-trigger");
diff --git a/include/linux/iio/trigger/stm32-exti-trigger.h b/include/linux/iio/trigger/stm32-exti-trigger.h
new file mode 100644
index 0000000..157ae58
--- /dev/null
+++ b/include/linux/iio/trigger/stm32-exti-trigger.h
@@ -0,0 +1,26 @@
+/*
+ * This file is part of STM32 EXTI Trigger driver
+ *
+ * Copyright (C) STMicroelectronics 2017
+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
+ *
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STM32_EXTI_TRIGGER_H_
+#define _STM32_EXTI_TRIGGER_H_
+
+#include <linux/stddef.h>
+
+#define STM32_EXTI(n)		"exti"#n
+
+#if IS_ENABLED(CONFIG_IIO_STM32_EXTI_TRIGGER)
+bool is_stm32_exti_trigger(struct iio_trigger *trig);
+#else
+static inline bool is_stm32_exti_trigger(struct iio_trigger *trig)
+{
+	return false;
+}
+#endif
+
+#endif
-- 
1.9.1

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

* [PATCH 5/5] iio: adc: stm32: add exti11 gpio trigger source
  2017-01-30 13:57 ` Fabrice Gasnier
  (?)
@ 2017-01-30 13:57   ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, fabrice.gasnier, benjamin.gaignard,
	benjamin.gaignard

STM32F4 ADC can use exti11 (gpio) signal as trigger source for
conversions.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index be0e457..0118c9c 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -26,6 +26,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/timer/stm32-timer-trigger.h>
+#include <linux/iio/trigger/stm32-exti-trigger.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
@@ -240,6 +241,7 @@ struct stm32_adc_chan_spec {
 	{ TIM5_CH3, STM32_EXT12 },
 	{ TIM8_CH1, STM32_EXT13 },
 	{ TIM8_TRGO, STM32_EXT14 },
+	{ STM32_EXTI(11), STM32_EXT15 },
 	{}, /* sentinel */
 };
 
@@ -409,6 +411,11 @@ static int stm32_adc_get_trig_extsel(struct iio_trigger *trig)
 		    !strcmp(stm32f4_adc_trigs[i].name, trig->name)) {
 			return stm32f4_adc_trigs[i].extsel;
 		}
+
+		if (is_stm32_exti_trigger(trig) &&
+		    !strcmp(stm32f4_adc_trigs[i].name, trig->name)) {
+			return stm32f4_adc_trigs[i].extsel;
+		}
 	}
 
 	return -EINVAL;
-- 
1.9.1

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

* [PATCH 5/5] iio: adc: stm32: add exti11 gpio trigger source
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: mark.rutland, benjamin.gaignard, lars, alexandre.torgue,
	linux-iio, pmeerw, mcoquelin.stm32, knaack.h, fabrice.gasnier,
	benjamin.gaignard

STM32F4 ADC can use exti11 (gpio) signal as trigger source for
conversions.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index be0e457..0118c9c 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -26,6 +26,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/timer/stm32-timer-trigger.h>
+#include <linux/iio/trigger/stm32-exti-trigger.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
@@ -240,6 +241,7 @@ struct stm32_adc_chan_spec {
 	{ TIM5_CH3, STM32_EXT12 },
 	{ TIM8_CH1, STM32_EXT13 },
 	{ TIM8_TRGO, STM32_EXT14 },
+	{ STM32_EXTI(11), STM32_EXT15 },
 	{}, /* sentinel */
 };
 
@@ -409,6 +411,11 @@ static int stm32_adc_get_trig_extsel(struct iio_trigger *trig)
 		    !strcmp(stm32f4_adc_trigs[i].name, trig->name)) {
 			return stm32f4_adc_trigs[i].extsel;
 		}
+
+		if (is_stm32_exti_trigger(trig) &&
+		    !strcmp(stm32f4_adc_trigs[i].name, trig->name)) {
+			return stm32f4_adc_trigs[i].extsel;
+		}
 	}
 
 	return -EINVAL;
-- 
1.9.1

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

* [PATCH 5/5] iio: adc: stm32: add exti11 gpio trigger source
@ 2017-01-30 13:57   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 13:57 UTC (permalink / raw)
  To: linux-arm-kernel

STM32F4 ADC can use exti11 (gpio) signal as trigger source for
conversions.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/adc/stm32-adc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index be0e457..0118c9c 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -26,6 +26,7 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/buffer.h>
 #include <linux/iio/timer/stm32-timer-trigger.h>
+#include <linux/iio/trigger/stm32-exti-trigger.h>
 #include <linux/iio/trigger.h>
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
@@ -240,6 +241,7 @@ struct stm32_adc_chan_spec {
 	{ TIM5_CH3, STM32_EXT12 },
 	{ TIM8_CH1, STM32_EXT13 },
 	{ TIM8_TRGO, STM32_EXT14 },
+	{ STM32_EXTI(11), STM32_EXT15 },
 	{}, /* sentinel */
 };
 
@@ -409,6 +411,11 @@ static int stm32_adc_get_trig_extsel(struct iio_trigger *trig)
 		    !strcmp(stm32f4_adc_trigs[i].name, trig->name)) {
 			return stm32f4_adc_trigs[i].extsel;
 		}
+
+		if (is_stm32_exti_trigger(trig) &&
+		    !strcmp(stm32f4_adc_trigs[i].name, trig->name)) {
+			return stm32f4_adc_trigs[i].extsel;
+		}
 	}
 
 	return -EINVAL;
-- 
1.9.1

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

* Re: [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC
  2017-01-30 13:57 ` Fabrice Gasnier
  (?)
@ 2017-01-30 14:09   ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 14:09 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, benjamin.gaignard, benjamin.gaignard

Hi all,

Please discard this series. I'll send a V2.
Sorry for the noise.

Best regards,
Fabrice

On 01/30/2017 02:57 PM, Fabrice Gasnier wrote:
> STM32 ADC, can use GPIOs configured as EXTI line (external interrupt)
> as trigger source for conversions.
> This patchset is based on latest IIO testing branch, and adds support
> for EXTi GPIO triggers in IIO.
> It also adds a dt option to configure default trigger polarity in
> STM32 ADC driver.
>
> Fabrice Gasnier (5):
>    Documentation: dt: iio: document stm32 adc trigger polarity
>    iio: adc: stm32: add dt option to set default trigger polarity
>    Documentation: dt: iio: document stm32 exti trigger
>    iio: trigger: add support for STM32 EXTI triggers
>    iio: adc: stm32: add exti11 gpio trigger source
>
>   .../devicetree/bindings/iio/adc/st,stm32-adc.txt   |   3 +
>   .../bindings/iio/trigger/st,stm32-exti-trigger.txt |  17 +++
>   drivers/iio/adc/stm32-adc.c                        |  14 +++
>   drivers/iio/trigger/Kconfig                        |  10 ++
>   drivers/iio/trigger/Makefile                       |   1 +
>   drivers/iio/trigger/stm32-exti-trigger.c           | 124 +++++++++++++++++++++
>   include/linux/iio/trigger/stm32-exti-trigger.h     |  26 +++++
>   7 files changed, 195 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>   create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
>   create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h
>

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

* Re: [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC
@ 2017-01-30 14:09   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 14:09 UTC (permalink / raw)
  To: jic23, linux, robh+dt, linux-arm-kernel, devicetree, linux-kernel
  Cc: mark.rutland, benjamin.gaignard, lars, alexandre.torgue,
	linux-iio, pmeerw, mcoquelin.stm32, knaack.h, benjamin.gaignard

Hi all,

Please discard this series. I'll send a V2.
Sorry for the noise.

Best regards,
Fabrice

On 01/30/2017 02:57 PM, Fabrice Gasnier wrote:
> STM32 ADC, can use GPIOs configured as EXTI line (external interrupt)
> as trigger source for conversions.
> This patchset is based on latest IIO testing branch, and adds support
> for EXTi GPIO triggers in IIO.
> It also adds a dt option to configure default trigger polarity in
> STM32 ADC driver.
>
> Fabrice Gasnier (5):
>    Documentation: dt: iio: document stm32 adc trigger polarity
>    iio: adc: stm32: add dt option to set default trigger polarity
>    Documentation: dt: iio: document stm32 exti trigger
>    iio: trigger: add support for STM32 EXTI triggers
>    iio: adc: stm32: add exti11 gpio trigger source
>
>   .../devicetree/bindings/iio/adc/st,stm32-adc.txt   |   3 +
>   .../bindings/iio/trigger/st,stm32-exti-trigger.txt |  17 +++
>   drivers/iio/adc/stm32-adc.c                        |  14 +++
>   drivers/iio/trigger/Kconfig                        |  10 ++
>   drivers/iio/trigger/Makefile                       |   1 +
>   drivers/iio/trigger/stm32-exti-trigger.c           | 124 +++++++++++++++++++++
>   include/linux/iio/trigger/stm32-exti-trigger.h     |  26 +++++
>   7 files changed, 195 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>   create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
>   create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h
>

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

* [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC
@ 2017-01-30 14:09   ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-01-30 14:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Please discard this series. I'll send a V2.
Sorry for the noise.

Best regards,
Fabrice

On 01/30/2017 02:57 PM, Fabrice Gasnier wrote:
> STM32 ADC, can use GPIOs configured as EXTI line (external interrupt)
> as trigger source for conversions.
> This patchset is based on latest IIO testing branch, and adds support
> for EXTi GPIO triggers in IIO.
> It also adds a dt option to configure default trigger polarity in
> STM32 ADC driver.
>
> Fabrice Gasnier (5):
>    Documentation: dt: iio: document stm32 adc trigger polarity
>    iio: adc: stm32: add dt option to set default trigger polarity
>    Documentation: dt: iio: document stm32 exti trigger
>    iio: trigger: add support for STM32 EXTI triggers
>    iio: adc: stm32: add exti11 gpio trigger source
>
>   .../devicetree/bindings/iio/adc/st,stm32-adc.txt   |   3 +
>   .../bindings/iio/trigger/st,stm32-exti-trigger.txt |  17 +++
>   drivers/iio/adc/stm32-adc.c                        |  14 +++
>   drivers/iio/trigger/Kconfig                        |  10 ++
>   drivers/iio/trigger/Makefile                       |   1 +
>   drivers/iio/trigger/stm32-exti-trigger.c           | 124 +++++++++++++++++++++
>   include/linux/iio/trigger/stm32-exti-trigger.h     |  26 +++++
>   7 files changed, 195 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>   create mode 100644 drivers/iio/trigger/stm32-exti-trigger.c
>   create mode 100644 include/linux/iio/trigger/stm32-exti-trigger.h
>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-01 16:35     ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-01 16:35 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: jic23, linux, linux-arm-kernel, devicetree, linux-kernel,
	linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, benjamin.gaignard, benjamin.gaignard

On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various

s/gpio/GPIO/

> IPs (e.g. for ADC or DAC conversions).

Please use "dt-bindings: iio:" for the subject prefix.

> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> new file mode 100644
> index 0000000..ebf2645
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> @@ -0,0 +1,17 @@
> +STMicroelectronics STM32 EXTI trigger bindings
> +
> +EXTi gpio signal can be routed internally as trigger source for various

s/gpio/GPIO/

> +IPs (e.g. for ADC or DAC conversions).
> +
> +Contents of a stm32 exti trigger root node:

Drop "root"

> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"

This whole binding looks a bit suspicious. Is this actually a h/w block? 
What makes it stm32 specific? Seems like the gpio properties should just 
be part of the ADC or DAC that they trigger.

> +- extiN-gpio: optional gpio line that may be used as external trigger source

-gpios is the preferred form.

> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +	triggers {
> +		compatible = "st,stm32-exti-trigger";
> +		exti11-gpio=<&gpioa 11 0>;

spaces around the "=".

> +	};
> -- 
> 1.9.1
> 

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-01 16:35     ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-01 16:35 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: jic23-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w,
	alexandre.torgue-qxv4g6HH51o, lars-Qo5EllUWu/uELgA04lAiVw,
	knaack.h-Mmb7MZpHnFY, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	benjamin.gaignard-QSEj5FYQhm4dnm+yROfE0A,
	benjamin.gaignard-qxv4g6HH51o

On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various

s/gpio/GPIO/

> IPs (e.g. for ADC or DAC conversions).

Please use "dt-bindings: iio:" for the subject prefix.

> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
> ---
>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> new file mode 100644
> index 0000000..ebf2645
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> @@ -0,0 +1,17 @@
> +STMicroelectronics STM32 EXTI trigger bindings
> +
> +EXTi gpio signal can be routed internally as trigger source for various

s/gpio/GPIO/

> +IPs (e.g. for ADC or DAC conversions).
> +
> +Contents of a stm32 exti trigger root node:

Drop "root"

> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"

This whole binding looks a bit suspicious. Is this actually a h/w block? 
What makes it stm32 specific? Seems like the gpio properties should just 
be part of the ADC or DAC that they trigger.

> +- extiN-gpio: optional gpio line that may be used as external trigger source

-gpios is the preferred form.

> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +	triggers {
> +		compatible = "st,stm32-exti-trigger";
> +		exti11-gpio=<&gpioa 11 0>;

spaces around the "=".

> +	};
> -- 
> 1.9.1
> 

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-01 16:35     ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-01 16:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various

s/gpio/GPIO/

> IPs (e.g. for ADC or DAC conversions).

Please use "dt-bindings: iio:" for the subject prefix.

> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> 
> diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> new file mode 100644
> index 0000000..ebf2645
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
> @@ -0,0 +1,17 @@
> +STMicroelectronics STM32 EXTI trigger bindings
> +
> +EXTi gpio signal can be routed internally as trigger source for various

s/gpio/GPIO/

> +IPs (e.g. for ADC or DAC conversions).
> +
> +Contents of a stm32 exti trigger root node:

Drop "root"

> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"

This whole binding looks a bit suspicious. Is this actually a h/w block? 
What makes it stm32 specific? Seems like the gpio properties should just 
be part of the ADC or DAC that they trigger.

> +- extiN-gpio: optional gpio line that may be used as external trigger source

-gpios is the preferred form.

> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +	triggers {
> +		compatible = "st,stm32-exti-trigger";
> +		exti11-gpio=<&gpioa 11 0>;

spaces around the "=".

> +	};
> -- 
> 1.9.1
> 

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
  2017-02-01 16:35     ` Rob Herring
  (?)
@ 2017-02-02  9:19       ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-02  9:19 UTC (permalink / raw)
  To: Rob Herring
  Cc: jic23, linux, linux-arm-kernel, devicetree, linux-kernel,
	linux-iio, mark.rutland, mcoquelin.stm32, alexandre.torgue, lars,
	knaack.h, pmeerw, benjamin.gaignard, benjamin.gaignard

On 02/01/2017 05:35 PM, Rob Herring wrote:
> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>> Add dt documentation for st,stm32-exti-trigger.
>> EXTi gpio signal can be routed internally as trigger source for various
>
> s/gpio/GPIO/
>
>> IPs (e.g. for ADC or DAC conversions).
>
> Please use "dt-bindings: iio:" for the subject prefix.

Hi Rob,

I'll fix this in V2.

>
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>> ---
>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>> new file mode 100644
>> index 0000000..ebf2645
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>> @@ -0,0 +1,17 @@
>> +STMicroelectronics STM32 EXTI trigger bindings
>> +
>> +EXTi gpio signal can be routed internally as trigger source for various
>
> s/gpio/GPIO/
>
>> +IPs (e.g. for ADC or DAC conversions).
>> +
>> +Contents of a stm32 exti trigger root node:
>
> Drop "root"
I'll fix these in V2.

>
>> +-------------------------------------------
>> +Required properties:
>> +- compatible: Should be "st,stm32-exti-trigger"
>
> This whole binding looks a bit suspicious. Is this actually a h/w block?
> What makes it stm32 specific? Seems like the gpio properties should just
> be part of the ADC or DAC that they trigger.

Please let me explain in more details.
I think best is I add following documentation in binding. Something like:

GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
                             |
        IIO trigger         --->         IIO device
                             |                  __________
                             |          inX  --|          \
                             |          ...  --|  SAR ADC  |-->
         __                  |         __      |__________/
PA11 --|  \                 | TIMx --|  \   trigger   ^
PB11 --|   |                  ...  --|   }----------->'
...  --|   }---- EXTI11 ---------->--|__/
      --|   |                |
PJ11 --|__/                 |

In fact, this driver configures GPIO and EXTI controllers (left side of
above scheme), and it registers corresponding trigger in IIO. Then it 
can be used by other IPs registered as IIO devices.

I think this should be outside of ADC or DAC IIO device drivers, to live 
in separate IIO trigger driver. It will avoid duplicating code (e.g. 
PATCH 4) into several IIO device drivers.

Is it ok to declare this as separate IIO trigger driver?
Maybe Jonathan could also advise on this ?

As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
PB11...) can be selected to generate (EXTI11) hardware trigger signal.

>
>> +- extiN-gpio: optional gpio line that may be used as external trigger source
>
> -gpios is the preferred form.

I apologize, I didn't make it clear in the first place. Please let me 
rephrase. Is bellow description more suitable ?

- extiN-gpio: One or several named GPIO lines that may be used as
   external trigger source by STM32 ADC, DAC. N may be 0..15.
   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
   trig DAC.

>
>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
>> +
>> +Example:
>> +	triggers {
>> +		compatible = "st,stm32-exti-trigger";
>> +		exti11-gpio=<&gpioa 11 0>;
>
> spaces around the "=".
I'll fix it in V2, and also add example for more that one EXTI trigger:

	triggers {
		compatible = "st,stm32-exti-trigger";
		exti9-gpio = <&gpioa 9 0>;
		exti11-gpio = <&gpioa 11 0>;
		...
	};

Above binding can typically be used in board dt, in case on-board gpio 
is connected/used as trigger source for IIO device (STM32 ADC/DAC).

Please let me know if this clarifies, so I'll do necessary changes in V2.

Many thanks for your review.
Best Regards,
Fabrice

>
>> +	};
>> --
>> 1.9.1
>>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-02  9:19       ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-02  9:19 UTC (permalink / raw)
  To: Rob Herring
  Cc: mark.rutland, devicetree, benjamin.gaignard, lars,
	alexandre.torgue, linux-iio, pmeerw, linux, linux-kernel, jic23,
	mcoquelin.stm32, knaack.h, linux-arm-kernel, benjamin.gaignard

On 02/01/2017 05:35 PM, Rob Herring wrote:
> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>> Add dt documentation for st,stm32-exti-trigger.
>> EXTi gpio signal can be routed internally as trigger source for various
>
> s/gpio/GPIO/
>
>> IPs (e.g. for ADC or DAC conversions).
>
> Please use "dt-bindings: iio:" for the subject prefix.

Hi Rob,

I'll fix this in V2.

>
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>> ---
>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>> new file mode 100644
>> index 0000000..ebf2645
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>> @@ -0,0 +1,17 @@
>> +STMicroelectronics STM32 EXTI trigger bindings
>> +
>> +EXTi gpio signal can be routed internally as trigger source for various
>
> s/gpio/GPIO/
>
>> +IPs (e.g. for ADC or DAC conversions).
>> +
>> +Contents of a stm32 exti trigger root node:
>
> Drop "root"
I'll fix these in V2.

>
>> +-------------------------------------------
>> +Required properties:
>> +- compatible: Should be "st,stm32-exti-trigger"
>
> This whole binding looks a bit suspicious. Is this actually a h/w block?
> What makes it stm32 specific? Seems like the gpio properties should just
> be part of the ADC or DAC that they trigger.

Please let me explain in more details.
I think best is I add following documentation in binding. Something like:

GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
                             |
        IIO trigger         --->         IIO device
                             |                  __________
                             |          inX  --|          \
                             |          ...  --|  SAR ADC  |-->
         __                  |         __      |__________/
PA11 --|  \                 | TIMx --|  \   trigger   ^
PB11 --|   |                  ...  --|   }----------->'
...  --|   }---- EXTI11 ---------->--|__/
      --|   |                |
PJ11 --|__/                 |

In fact, this driver configures GPIO and EXTI controllers (left side of
above scheme), and it registers corresponding trigger in IIO. Then it 
can be used by other IPs registered as IIO devices.

I think this should be outside of ADC or DAC IIO device drivers, to live 
in separate IIO trigger driver. It will avoid duplicating code (e.g. 
PATCH 4) into several IIO device drivers.

Is it ok to declare this as separate IIO trigger driver?
Maybe Jonathan could also advise on this ?

As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
PB11...) can be selected to generate (EXTI11) hardware trigger signal.

>
>> +- extiN-gpio: optional gpio line that may be used as external trigger source
>
> -gpios is the preferred form.

I apologize, I didn't make it clear in the first place. Please let me 
rephrase. Is bellow description more suitable ?

- extiN-gpio: One or several named GPIO lines that may be used as
   external trigger source by STM32 ADC, DAC. N may be 0..15.
   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
   trig DAC.

>
>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
>> +
>> +Example:
>> +	triggers {
>> +		compatible = "st,stm32-exti-trigger";
>> +		exti11-gpio=<&gpioa 11 0>;
>
> spaces around the "=".
I'll fix it in V2, and also add example for more that one EXTI trigger:

	triggers {
		compatible = "st,stm32-exti-trigger";
		exti9-gpio = <&gpioa 9 0>;
		exti11-gpio = <&gpioa 11 0>;
		...
	};

Above binding can typically be used in board dt, in case on-board gpio 
is connected/used as trigger source for IIO device (STM32 ADC/DAC).

Please let me know if this clarifies, so I'll do necessary changes in V2.

Many thanks for your review.
Best Regards,
Fabrice

>
>> +	};
>> --
>> 1.9.1
>>

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-02  9:19       ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-02  9:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/01/2017 05:35 PM, Rob Herring wrote:
> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>> Add dt documentation for st,stm32-exti-trigger.
>> EXTi gpio signal can be routed internally as trigger source for various
>
> s/gpio/GPIO/
>
>> IPs (e.g. for ADC or DAC conversions).
>
> Please use "dt-bindings: iio:" for the subject prefix.

Hi Rob,

I'll fix this in V2.

>
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>> ---
>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>> new file mode 100644
>> index 0000000..ebf2645
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>> @@ -0,0 +1,17 @@
>> +STMicroelectronics STM32 EXTI trigger bindings
>> +
>> +EXTi gpio signal can be routed internally as trigger source for various
>
> s/gpio/GPIO/
>
>> +IPs (e.g. for ADC or DAC conversions).
>> +
>> +Contents of a stm32 exti trigger root node:
>
> Drop "root"
I'll fix these in V2.

>
>> +-------------------------------------------
>> +Required properties:
>> +- compatible: Should be "st,stm32-exti-trigger"
>
> This whole binding looks a bit suspicious. Is this actually a h/w block?
> What makes it stm32 specific? Seems like the gpio properties should just
> be part of the ADC or DAC that they trigger.

Please let me explain in more details.
I think best is I add following documentation in binding. Something like:

GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
                             |
        IIO trigger         --->         IIO device
                             |                  __________
                             |          inX  --|          \
                             |          ...  --|  SAR ADC  |-->
         __                  |         __      |__________/
PA11 --|  \                 | TIMx --|  \   trigger   ^
PB11 --|   |                  ...  --|   }----------->'
...  --|   }---- EXTI11 ---------->--|__/
      --|   |                |
PJ11 --|__/                 |

In fact, this driver configures GPIO and EXTI controllers (left side of
above scheme), and it registers corresponding trigger in IIO. Then it 
can be used by other IPs registered as IIO devices.

I think this should be outside of ADC or DAC IIO device drivers, to live 
in separate IIO trigger driver. It will avoid duplicating code (e.g. 
PATCH 4) into several IIO device drivers.

Is it ok to declare this as separate IIO trigger driver?
Maybe Jonathan could also advise on this ?

As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
PB11...) can be selected to generate (EXTI11) hardware trigger signal.

>
>> +- extiN-gpio: optional gpio line that may be used as external trigger source
>
> -gpios is the preferred form.

I apologize, I didn't make it clear in the first place. Please let me 
rephrase. Is bellow description more suitable ?

- extiN-gpio: One or several named GPIO lines that may be used as
   external trigger source by STM32 ADC, DAC. N may be 0..15.
   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
   trig DAC.

>
>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
>> +
>> +Example:
>> +	triggers {
>> +		compatible = "st,stm32-exti-trigger";
>> +		exti11-gpio=<&gpioa 11 0>;
>
> spaces around the "=".
I'll fix it in V2, and also add example for more that one EXTI trigger:

	triggers {
		compatible = "st,stm32-exti-trigger";
		exti9-gpio = <&gpioa 9 0>;
		exti11-gpio = <&gpioa 11 0>;
		...
	};

Above binding can typically be used in board dt, in case on-board gpio 
is connected/used as trigger source for IIO device (STM32 ADC/DAC).

Please let me know if this clarifies, so I'll do necessary changes in V2.

Many thanks for your review.
Best Regards,
Fabrice

>
>> +	};
>> --
>> 1.9.1
>>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-02 15:45         ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-02 15:45 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: Jonathan Cameron, Russell King, linux-arm-kernel, devicetree,
	linux-kernel, linux-iio, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, Lars-Peter Clausen, Hartmut Knaack,
	Peter Meerwald, Benjamin Gaignard, Benjamin Gaignard,
	Linus Walleij

+Linus W

On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>
>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>
>>> Add dt documentation for st,stm32-exti-trigger.
>>> EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> IPs (e.g. for ADC or DAC conversions).
>>
>>
>> Please use "dt-bindings: iio:" for the subject prefix.
>
>
> Hi Rob,
>
> I'll fix this in V2.
>
>>
>>>
>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>> ---
>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>> +++++++++++++++++
>>>  1 file changed, 17 insertions(+)
>>>  create mode 100644
>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> new file mode 100644
>>> index 0000000..ebf2645
>>> --- /dev/null
>>> +++
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> @@ -0,0 +1,17 @@
>>> +STMicroelectronics STM32 EXTI trigger bindings
>>> +
>>> +EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> +IPs (e.g. for ADC or DAC conversions).
>>> +
>>> +Contents of a stm32 exti trigger root node:
>>
>>
>> Drop "root"
>
> I'll fix these in V2.
>
>>
>>> +-------------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-exti-trigger"
>>
>>
>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>> What makes it stm32 specific? Seems like the gpio properties should just
>> be part of the ADC or DAC that they trigger.
>
>
> Please let me explain in more details.
> I think best is I add following documentation in binding. Something like:
>
> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>                             |
>        IIO trigger         --->         IIO device
>                             |                  __________
>                             |          inX  --|          \
>                             |          ...  --|  SAR ADC  |-->
>         __                  |         __      |__________/
> PA11 --|  \                 | TIMx --|  \   trigger   ^
> PB11 --|   |                  ...  --|   }----------->'
> ...  --|   }---- EXTI11 ---------->--|__/
>      --|   |                |
> PJ11 --|__/                 |
>
> In fact, this driver configures GPIO and EXTI controllers (left side of
> above scheme), and it registers corresponding trigger in IIO. Then it can be
> used by other IPs registered as IIO devices.
>
> I think this should be outside of ADC or DAC IIO device drivers, to live in
> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
> into several IIO device drivers.
>
> Is it ok to declare this as separate IIO trigger driver?

Drivers and DT nodes are not necessarily 1 to 1.

What controls the GPIO line that is used for the trigger?

> Maybe Jonathan could also advise on this ?
>
> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
> PB11...) can be selected to generate (EXTI11) hardware trigger signal.

This seems more like a pinmux'ing issue than a GPIO. This isn't really
a GPIO if it is routed to a h/w control.

A -gpios property for a trigger would make sense if you had a driver
handling GPIO interrupts to generate IIO triggers. This seems to be
just mux control.

>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>> source
>>
>>
>> -gpios is the preferred form.
>
>
> I apologize, I didn't make it clear in the first place. Please let me
> rephrase. Is bellow description more suitable ?

What I mean is the property name is wrong. It should be "extiN-gpios".

>
> - extiN-gpio: One or several named GPIO lines that may be used as
>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>   trig DAC.
>
>>
>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>> stm32f4).
>>> +
>>> +Example:
>>> +       triggers {
>>> +               compatible = "st,stm32-exti-trigger";
>>> +               exti11-gpio=<&gpioa 11 0>;
>>
>>
>> spaces around the "=".
>
> I'll fix it in V2, and also add example for more that one EXTI trigger:
>
>         triggers {
>                 compatible = "st,stm32-exti-trigger";
>                 exti9-gpio = <&gpioa 9 0>;
>                 exti11-gpio = <&gpioa 11 0>;
>                 ...
>         };
>
> Above binding can typically be used in board dt, in case on-board gpio is
> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>
> Please let me know if this clarifies, so I'll do necessary changes in V2.
>
> Many thanks for your review.
> Best Regards,
> Fabrice
>
>>
>>> +       };
>>> --
>>> 1.9.1
>>>
>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-02 15:45         ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-02 15:45 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: Jonathan Cameron, Russell King,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, Lars-Peter Clausen, Hartmut Knaack,
	Peter Meerwald, Benjamin Gaignard, Benjamin Gaignard,
	Linus Walleij

+Linus W

On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote:
> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>
>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>
>>> Add dt documentation for st,stm32-exti-trigger.
>>> EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> IPs (e.g. for ADC or DAC conversions).
>>
>>
>> Please use "dt-bindings: iio:" for the subject prefix.
>
>
> Hi Rob,
>
> I'll fix this in V2.
>
>>
>>>
>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org>
>>> ---
>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>> +++++++++++++++++
>>>  1 file changed, 17 insertions(+)
>>>  create mode 100644
>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> new file mode 100644
>>> index 0000000..ebf2645
>>> --- /dev/null
>>> +++
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> @@ -0,0 +1,17 @@
>>> +STMicroelectronics STM32 EXTI trigger bindings
>>> +
>>> +EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> +IPs (e.g. for ADC or DAC conversions).
>>> +
>>> +Contents of a stm32 exti trigger root node:
>>
>>
>> Drop "root"
>
> I'll fix these in V2.
>
>>
>>> +-------------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-exti-trigger"
>>
>>
>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>> What makes it stm32 specific? Seems like the gpio properties should just
>> be part of the ADC or DAC that they trigger.
>
>
> Please let me explain in more details.
> I think best is I add following documentation in binding. Something like:
>
> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>                             |
>        IIO trigger         --->         IIO device
>                             |                  __________
>                             |          inX  --|          \
>                             |          ...  --|  SAR ADC  |-->
>         __                  |         __      |__________/
> PA11 --|  \                 | TIMx --|  \   trigger   ^
> PB11 --|   |                  ...  --|   }----------->'
> ...  --|   }---- EXTI11 ---------->--|__/
>      --|   |                |
> PJ11 --|__/                 |
>
> In fact, this driver configures GPIO and EXTI controllers (left side of
> above scheme), and it registers corresponding trigger in IIO. Then it can be
> used by other IPs registered as IIO devices.
>
> I think this should be outside of ADC or DAC IIO device drivers, to live in
> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
> into several IIO device drivers.
>
> Is it ok to declare this as separate IIO trigger driver?

Drivers and DT nodes are not necessarily 1 to 1.

What controls the GPIO line that is used for the trigger?

> Maybe Jonathan could also advise on this ?
>
> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
> PB11...) can be selected to generate (EXTI11) hardware trigger signal.

This seems more like a pinmux'ing issue than a GPIO. This isn't really
a GPIO if it is routed to a h/w control.

A -gpios property for a trigger would make sense if you had a driver
handling GPIO interrupts to generate IIO triggers. This seems to be
just mux control.

>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>> source
>>
>>
>> -gpios is the preferred form.
>
>
> I apologize, I didn't make it clear in the first place. Please let me
> rephrase. Is bellow description more suitable ?

What I mean is the property name is wrong. It should be "extiN-gpios".

>
> - extiN-gpio: One or several named GPIO lines that may be used as
>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>   trig DAC.
>
>>
>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>> stm32f4).
>>> +
>>> +Example:
>>> +       triggers {
>>> +               compatible = "st,stm32-exti-trigger";
>>> +               exti11-gpio=<&gpioa 11 0>;
>>
>>
>> spaces around the "=".
>
> I'll fix it in V2, and also add example for more that one EXTI trigger:
>
>         triggers {
>                 compatible = "st,stm32-exti-trigger";
>                 exti9-gpio = <&gpioa 9 0>;
>                 exti11-gpio = <&gpioa 11 0>;
>                 ...
>         };
>
> Above binding can typically be used in board dt, in case on-board gpio is
> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>
> Please let me know if this clarifies, so I'll do necessary changes in V2.
>
> Many thanks for your review.
> Best Regards,
> Fabrice
>
>>
>>> +       };
>>> --
>>> 1.9.1
>>>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-02 15:45         ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-02 15:45 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: Jonathan Cameron, Russell King, linux-arm-kernel, devicetree,
	linux-kernel, linux-iio, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, Lars-Peter Clausen, Hartmut Knaack,
	Peter Meerwald, Benjamin Gaignard, Benjamin Gaignard,
	Linus Walleij

+Linus W

On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>
>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>
>>> Add dt documentation for st,stm32-exti-trigger.
>>> EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> IPs (e.g. for ADC or DAC conversions).
>>
>>
>> Please use "dt-bindings: iio:" for the subject prefix.
>
>
> Hi Rob,
>
> I'll fix this in V2.
>
>>
>>>
>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>> ---
>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>> +++++++++++++++++
>>>  1 file changed, 17 insertions(+)
>>>  create mode 100644
>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> new file mode 100644
>>> index 0000000..ebf2645
>>> --- /dev/null
>>> +++
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> @@ -0,0 +1,17 @@
>>> +STMicroelectronics STM32 EXTI trigger bindings
>>> +
>>> +EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> +IPs (e.g. for ADC or DAC conversions).
>>> +
>>> +Contents of a stm32 exti trigger root node:
>>
>>
>> Drop "root"
>
> I'll fix these in V2.
>
>>
>>> +-------------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-exti-trigger"
>>
>>
>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>> What makes it stm32 specific? Seems like the gpio properties should just
>> be part of the ADC or DAC that they trigger.
>
>
> Please let me explain in more details.
> I think best is I add following documentation in binding. Something like:
>
> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>                             |
>        IIO trigger         --->         IIO device
>                             |                  __________
>                             |          inX  --|          \
>                             |          ...  --|  SAR ADC  |-->
>         __                  |         __      |__________/
> PA11 --|  \                 | TIMx --|  \   trigger   ^
> PB11 --|   |                  ...  --|   }----------->'
> ...  --|   }---- EXTI11 ---------->--|__/
>      --|   |                |
> PJ11 --|__/                 |
>
> In fact, this driver configures GPIO and EXTI controllers (left side of
> above scheme), and it registers corresponding trigger in IIO. Then it can be
> used by other IPs registered as IIO devices.
>
> I think this should be outside of ADC or DAC IIO device drivers, to live in
> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
> into several IIO device drivers.
>
> Is it ok to declare this as separate IIO trigger driver?

Drivers and DT nodes are not necessarily 1 to 1.

What controls the GPIO line that is used for the trigger?

> Maybe Jonathan could also advise on this ?
>
> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
> PB11...) can be selected to generate (EXTI11) hardware trigger signal.

This seems more like a pinmux'ing issue than a GPIO. This isn't really
a GPIO if it is routed to a h/w control.

A -gpios property for a trigger would make sense if you had a driver
handling GPIO interrupts to generate IIO triggers. This seems to be
just mux control.

>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>> source
>>
>>
>> -gpios is the preferred form.
>
>
> I apologize, I didn't make it clear in the first place. Please let me
> rephrase. Is bellow description more suitable ?

What I mean is the property name is wrong. It should be "extiN-gpios".

>
> - extiN-gpio: One or several named GPIO lines that may be used as
>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>   trig DAC.
>
>>
>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>> stm32f4).
>>> +
>>> +Example:
>>> +       triggers {
>>> +               compatible = "st,stm32-exti-trigger";
>>> +               exti11-gpio=<&gpioa 11 0>;
>>
>>
>> spaces around the "=".
>
> I'll fix it in V2, and also add example for more that one EXTI trigger:
>
>         triggers {
>                 compatible = "st,stm32-exti-trigger";
>                 exti9-gpio = <&gpioa 9 0>;
>                 exti11-gpio = <&gpioa 11 0>;
>                 ...
>         };
>
> Above binding can typically be used in board dt, in case on-board gpio is
> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>
> Please let me know if this clarifies, so I'll do necessary changes in V2.
>
> Many thanks for your review.
> Best Regards,
> Fabrice
>
>>
>>> +       };
>>> --
>>> 1.9.1
>>>
>

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-02 15:45         ` Rob Herring
  0 siblings, 0 replies; 39+ messages in thread
From: Rob Herring @ 2017-02-02 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

+Linus W

On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>
>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>
>>> Add dt documentation for st,stm32-exti-trigger.
>>> EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> IPs (e.g. for ADC or DAC conversions).
>>
>>
>> Please use "dt-bindings: iio:" for the subject prefix.
>
>
> Hi Rob,
>
> I'll fix this in V2.
>
>>
>>>
>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>> ---
>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>> +++++++++++++++++
>>>  1 file changed, 17 insertions(+)
>>>  create mode 100644
>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> new file mode 100644
>>> index 0000000..ebf2645
>>> --- /dev/null
>>> +++
>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>> @@ -0,0 +1,17 @@
>>> +STMicroelectronics STM32 EXTI trigger bindings
>>> +
>>> +EXTi gpio signal can be routed internally as trigger source for various
>>
>>
>> s/gpio/GPIO/
>>
>>> +IPs (e.g. for ADC or DAC conversions).
>>> +
>>> +Contents of a stm32 exti trigger root node:
>>
>>
>> Drop "root"
>
> I'll fix these in V2.
>
>>
>>> +-------------------------------------------
>>> +Required properties:
>>> +- compatible: Should be "st,stm32-exti-trigger"
>>
>>
>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>> What makes it stm32 specific? Seems like the gpio properties should just
>> be part of the ADC or DAC that they trigger.
>
>
> Please let me explain in more details.
> I think best is I add following documentation in binding. Something like:
>
> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>                             |
>        IIO trigger         --->         IIO device
>                             |                  __________
>                             |          inX  --|          \
>                             |          ...  --|  SAR ADC  |-->
>         __                  |         __      |__________/
> PA11 --|  \                 | TIMx --|  \   trigger   ^
> PB11 --|   |                  ...  --|   }----------->'
> ...  --|   }---- EXTI11 ---------->--|__/
>      --|   |                |
> PJ11 --|__/                 |
>
> In fact, this driver configures GPIO and EXTI controllers (left side of
> above scheme), and it registers corresponding trigger in IIO. Then it can be
> used by other IPs registered as IIO devices.
>
> I think this should be outside of ADC or DAC IIO device drivers, to live in
> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
> into several IIO device drivers.
>
> Is it ok to declare this as separate IIO trigger driver?

Drivers and DT nodes are not necessarily 1 to 1.

What controls the GPIO line that is used for the trigger?

> Maybe Jonathan could also advise on this ?
>
> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
> PB11...) can be selected to generate (EXTI11) hardware trigger signal.

This seems more like a pinmux'ing issue than a GPIO. This isn't really
a GPIO if it is routed to a h/w control.

A -gpios property for a trigger would make sense if you had a driver
handling GPIO interrupts to generate IIO triggers. This seems to be
just mux control.

>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>> source
>>
>>
>> -gpios is the preferred form.
>
>
> I apologize, I didn't make it clear in the first place. Please let me
> rephrase. Is bellow description more suitable ?

What I mean is the property name is wrong. It should be "extiN-gpios".

>
> - extiN-gpio: One or several named GPIO lines that may be used as
>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>   trig DAC.
>
>>
>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>> stm32f4).
>>> +
>>> +Example:
>>> +       triggers {
>>> +               compatible = "st,stm32-exti-trigger";
>>> +               exti11-gpio=<&gpioa 11 0>;
>>
>>
>> spaces around the "=".
>
> I'll fix it in V2, and also add example for more that one EXTI trigger:
>
>         triggers {
>                 compatible = "st,stm32-exti-trigger";
>                 exti9-gpio = <&gpioa 9 0>;
>                 exti11-gpio = <&gpioa 11 0>;
>                 ...
>         };
>
> Above binding can typically be used in board dt, in case on-board gpio is
> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>
> Please let me know if this clarifies, so I'll do necessary changes in V2.
>
> Many thanks for your review.
> Best Regards,
> Fabrice
>
>>
>>> +       };
>>> --
>>> 1.9.1
>>>
>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
  2017-02-02 15:45         ` Rob Herring
  (?)
  (?)
@ 2017-02-03 10:37           ` Fabrice Gasnier
  -1 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-03 10:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: Jonathan Cameron, Russell King, linux-arm-kernel, devicetree,
	linux-kernel, linux-iio, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, Lars-Peter Clausen, Hartmut Knaack,
	Peter Meerwald, Benjamin Gaignard, Benjamin Gaignard,
	Linus Walleij

On 02/02/2017 04:45 PM, Rob Herring wrote:
> +Linus W
>
> On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
>> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>>
>>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>>
>>>> Add dt documentation for st,stm32-exti-trigger.
>>>> EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> IPs (e.g. for ADC or DAC conversions).
>>>
>>>
>>> Please use "dt-bindings: iio:" for the subject prefix.
>>
>>
>> Hi Rob,
>>
>> I'll fix this in V2.
>>
>>>
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> ---
>>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>>> +++++++++++++++++
>>>>  1 file changed, 17 insertions(+)
>>>>  create mode 100644
>>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>>
>>>> diff --git
>>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> new file mode 100644
>>>> index 0000000..ebf2645
>>>> --- /dev/null
>>>> +++
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> @@ -0,0 +1,17 @@
>>>> +STMicroelectronics STM32 EXTI trigger bindings
>>>> +
>>>> +EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> +IPs (e.g. for ADC or DAC conversions).
>>>> +
>>>> +Contents of a stm32 exti trigger root node:
>>>
>>>
>>> Drop "root"
>>
>> I'll fix these in V2.
>>
>>>
>>>> +-------------------------------------------
>>>> +Required properties:
>>>> +- compatible: Should be "st,stm32-exti-trigger"
>>>
>>>
>>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>>> What makes it stm32 specific? Seems like the gpio properties should just
>>> be part of the ADC or DAC that they trigger.
>>
>>
>> Please let me explain in more details.
>> I think best is I add following documentation in binding. Something like:
>>
>> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>>                             |
>>        IIO trigger         --->         IIO device
>>                             |                  __________
>>                             |          inX  --|          \
>>                             |          ...  --|  SAR ADC  |-->
>>         __                  |         __      |__________/
>> PA11 --|  \                 | TIMx --|  \   trigger   ^
>> PB11 --|   |                  ...  --|   }----------->'
>> ...  --|   }---- EXTI11 ---------->--|__/
>>      --|   |                |
>> PJ11 --|__/                 |
>>
>> In fact, this driver configures GPIO and EXTI controllers (left side of
>> above scheme), and it registers corresponding trigger in IIO. Then it can be
>> used by other IPs registered as IIO devices.
>>
>> I think this should be outside of ADC or DAC IIO device drivers, to live in
>> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
>> into several IIO device drivers.
>>
>> Is it ok to declare this as separate IIO trigger driver?
>
> Drivers and DT nodes are not necessarily 1 to 1.
Hi Rob,

Sorry, I don't get it. Can you clarify ?

>
> What controls the GPIO line that is used for the trigger?

This can be anything connected to GPIO line, such as (on board)
push-button, external synchronization signal ...

>
>> Maybe Jonathan could also advise on this ?
>>
>> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
>> PB11...) can be selected to generate (EXTI11) hardware trigger signal.
>
> This seems more like a pinmux'ing issue than a GPIO. This isn't really
> a GPIO if it is routed to a h/w control.

Sorry, muxing part (e.g. PA11, PB11...) isn't shown in above scheme.
GPIO is muxed via gpio/pinctrl driver.

>
> A -gpios property for a trigger would make sense if you had a driver
> handling GPIO interrupts to generate IIO triggers. This seems to be
> just mux control.

This is almost it, there are two stages.
- trigger starts conversion on device (e.g. ADC...) by hardware (no need 
for interrupt on 1st stage, data isn't ready anyway).
- 2nd stage, end of conversion polls the trigger.

Just to summarize, rephrase, in case push button is used to trigger 
conversions:
- 1st declare GPIO (to which push button is connected)
- GPIO is muxed into external interrupt (e.g. EXTI) by using pinctrl
and exti driver. This may be compared to a 'gpio_keys' up to this point.
- EXTI line is able to either generate an interrupt (not used here)
and/or start conversion as trigger line (that is used here).
- end of conversion does the actual trigger poll.

>
>>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>>> source
>>>
>>>
>>> -gpios is the preferred form.
>>
>>
>> I apologize, I didn't make it clear in the first place. Please let me
>> rephrase. Is bellow description more suitable ?
>
> What I mean is the property name is wrong. It should be "extiN-gpios".
Oh... got it, thanks.
I'll update this.

Best Regards,
Fabrice
>
>>
>> - extiN-gpio: One or several named GPIO lines that may be used as
>>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>>   trig DAC.
>>
>>>
>>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>>> stm32f4).
>>>> +
>>>> +Example:
>>>> +       triggers {
>>>> +               compatible = "st,stm32-exti-trigger";
>>>> +               exti11-gpio=<&gpioa 11 0>;
>>>
>>>
>>> spaces around the "=".
>>
>> I'll fix it in V2, and also add example for more that one EXTI trigger:
>>
>>         triggers {
>>                 compatible = "st,stm32-exti-trigger";
>>                 exti9-gpio = <&gpioa 9 0>;
>>                 exti11-gpio = <&gpioa 11 0>;
>>                 ...
>>         };
>>
>> Above binding can typically be used in board dt, in case on-board gpio is
>> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>>
>> Please let me know if this clarifies, so I'll do necessary changes in V2.
>>
>> Many thanks for your review.
>> Best Regards,
>> Fabrice
>>
>>>
>>>> +       };
>>>> --
>>>> 1.9.1
>>>>
>>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 10:37           ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-03 10:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Rutland, devicetree, Benjamin Gaignard, Lars-Peter Clausen,
	Alexandre Torgue, linux-iio, Peter Meerwald, Russell King,
	linux-kernel, Jonathan Cameron, Maxime Coquelin, Hartmut Knaack,
	Linus Walleij, linux-arm-kernel, Benjamin Gaignard

On 02/02/2017 04:45 PM, Rob Herring wrote:
> +Linus W
>
> On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
>> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>>
>>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>>
>>>> Add dt documentation for st,stm32-exti-trigger.
>>>> EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> IPs (e.g. for ADC or DAC conversions).
>>>
>>>
>>> Please use "dt-bindings: iio:" for the subject prefix.
>>
>>
>> Hi Rob,
>>
>> I'll fix this in V2.
>>
>>>
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> ---
>>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>>> +++++++++++++++++
>>>>  1 file changed, 17 insertions(+)
>>>>  create mode 100644
>>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>>
>>>> diff --git
>>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> new file mode 100644
>>>> index 0000000..ebf2645
>>>> --- /dev/null
>>>> +++
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> @@ -0,0 +1,17 @@
>>>> +STMicroelectronics STM32 EXTI trigger bindings
>>>> +
>>>> +EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> +IPs (e.g. for ADC or DAC conversions).
>>>> +
>>>> +Contents of a stm32 exti trigger root node:
>>>
>>>
>>> Drop "root"
>>
>> I'll fix these in V2.
>>
>>>
>>>> +-------------------------------------------
>>>> +Required properties:
>>>> +- compatible: Should be "st,stm32-exti-trigger"
>>>
>>>
>>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>>> What makes it stm32 specific? Seems like the gpio properties should just
>>> be part of the ADC or DAC that they trigger.
>>
>>
>> Please let me explain in more details.
>> I think best is I add following documentation in binding. Something like:
>>
>> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>>                             |
>>        IIO trigger         --->         IIO device
>>                             |                  __________
>>                             |          inX  --|          \
>>                             |          ...  --|  SAR ADC  |-->
>>         __                  |         __      |__________/
>> PA11 --|  \                 | TIMx --|  \   trigger   ^
>> PB11 --|   |                  ...  --|   }----------->'
>> ...  --|   }---- EXTI11 ---------->--|__/
>>      --|   |                |
>> PJ11 --|__/                 |
>>
>> In fact, this driver configures GPIO and EXTI controllers (left side of
>> above scheme), and it registers corresponding trigger in IIO. Then it can be
>> used by other IPs registered as IIO devices.
>>
>> I think this should be outside of ADC or DAC IIO device drivers, to live in
>> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
>> into several IIO device drivers.
>>
>> Is it ok to declare this as separate IIO trigger driver?
>
> Drivers and DT nodes are not necessarily 1 to 1.
Hi Rob,

Sorry, I don't get it. Can you clarify ?

>
> What controls the GPIO line that is used for the trigger?

This can be anything connected to GPIO line, such as (on board)
push-button, external synchronization signal ...

>
>> Maybe Jonathan could also advise on this ?
>>
>> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
>> PB11...) can be selected to generate (EXTI11) hardware trigger signal.
>
> This seems more like a pinmux'ing issue than a GPIO. This isn't really
> a GPIO if it is routed to a h/w control.

Sorry, muxing part (e.g. PA11, PB11...) isn't shown in above scheme.
GPIO is muxed via gpio/pinctrl driver.

>
> A -gpios property for a trigger would make sense if you had a driver
> handling GPIO interrupts to generate IIO triggers. This seems to be
> just mux control.

This is almost it, there are two stages.
- trigger starts conversion on device (e.g. ADC...) by hardware (no need 
for interrupt on 1st stage, data isn't ready anyway).
- 2nd stage, end of conversion polls the trigger.

Just to summarize, rephrase, in case push button is used to trigger 
conversions:
- 1st declare GPIO (to which push button is connected)
- GPIO is muxed into external interrupt (e.g. EXTI) by using pinctrl
and exti driver. This may be compared to a 'gpio_keys' up to this point.
- EXTI line is able to either generate an interrupt (not used here)
and/or start conversion as trigger line (that is used here).
- end of conversion does the actual trigger poll.

>
>>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>>> source
>>>
>>>
>>> -gpios is the preferred form.
>>
>>
>> I apologize, I didn't make it clear in the first place. Please let me
>> rephrase. Is bellow description more suitable ?
>
> What I mean is the property name is wrong. It should be "extiN-gpios".
Oh... got it, thanks.
I'll update this.

Best Regards,
Fabrice
>
>>
>> - extiN-gpio: One or several named GPIO lines that may be used as
>>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>>   trig DAC.
>>
>>>
>>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>>> stm32f4).
>>>> +
>>>> +Example:
>>>> +       triggers {
>>>> +               compatible = "st,stm32-exti-trigger";
>>>> +               exti11-gpio=<&gpioa 11 0>;
>>>
>>>
>>> spaces around the "=".
>>
>> I'll fix it in V2, and also add example for more that one EXTI trigger:
>>
>>         triggers {
>>                 compatible = "st,stm32-exti-trigger";
>>                 exti9-gpio = <&gpioa 9 0>;
>>                 exti11-gpio = <&gpioa 11 0>;
>>                 ...
>>         };
>>
>> Above binding can typically be used in board dt, in case on-board gpio is
>> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>>
>> Please let me know if this clarifies, so I'll do necessary changes in V2.
>>
>> Many thanks for your review.
>> Best Regards,
>> Fabrice
>>
>>>
>>>> +       };
>>>> --
>>>> 1.9.1
>>>>
>>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 10:37           ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-03 10:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: Jonathan Cameron, Russell King, linux-arm-kernel, devicetree,
	linux-kernel, linux-iio, Mark Rutland, Maxime Coquelin,
	Alexandre Torgue, Lars-Peter Clausen, Hartmut Knaack,
	Peter Meerwald, Benjamin Gaignard, Benjamin Gaignard,
	Linus Walleij

On 02/02/2017 04:45 PM, Rob Herring wrote:
> +Linus W
>
> On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
>> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>>
>>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>>
>>>> Add dt documentation for st,stm32-exti-trigger.
>>>> EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> IPs (e.g. for ADC or DAC conversions).
>>>
>>>
>>> Please use "dt-bindings: iio:" for the subject prefix.
>>
>>
>> Hi Rob,
>>
>> I'll fix this in V2.
>>
>>>
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> ---
>>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>>> +++++++++++++++++
>>>>  1 file changed, 17 insertions(+)
>>>>  create mode 100644
>>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>>
>>>> diff --git
>>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> new file mode 100644
>>>> index 0000000..ebf2645
>>>> --- /dev/null
>>>> +++
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> @@ -0,0 +1,17 @@
>>>> +STMicroelectronics STM32 EXTI trigger bindings
>>>> +
>>>> +EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> +IPs (e.g. for ADC or DAC conversions).
>>>> +
>>>> +Contents of a stm32 exti trigger root node:
>>>
>>>
>>> Drop "root"
>>
>> I'll fix these in V2.
>>
>>>
>>>> +-------------------------------------------
>>>> +Required properties:
>>>> +- compatible: Should be "st,stm32-exti-trigger"
>>>
>>>
>>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>>> What makes it stm32 specific? Seems like the gpio properties should just
>>> be part of the ADC or DAC that they trigger.
>>
>>
>> Please let me explain in more details.
>> I think best is I add following documentation in binding. Something like:
>>
>> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>>                             |
>>        IIO trigger         --->         IIO device
>>                             |                  __________
>>                             |          inX  --|          \
>>                             |          ...  --|  SAR ADC  |-->
>>         __                  |         __      |__________/
>> PA11 --|  \                 | TIMx --|  \   trigger   ^
>> PB11 --|   |                  ...  --|   }----------->'
>> ...  --|   }---- EXTI11 ---------->--|__/
>>      --|   |                |
>> PJ11 --|__/                 |
>>
>> In fact, this driver configures GPIO and EXTI controllers (left side of
>> above scheme), and it registers corresponding trigger in IIO. Then it can be
>> used by other IPs registered as IIO devices.
>>
>> I think this should be outside of ADC or DAC IIO device drivers, to live in
>> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
>> into several IIO device drivers.
>>
>> Is it ok to declare this as separate IIO trigger driver?
>
> Drivers and DT nodes are not necessarily 1 to 1.
Hi Rob,

Sorry, I don't get it. Can you clarify ?

>
> What controls the GPIO line that is used for the trigger?

This can be anything connected to GPIO line, such as (on board)
push-button, external synchronization signal ...

>
>> Maybe Jonathan could also advise on this ?
>>
>> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
>> PB11...) can be selected to generate (EXTI11) hardware trigger signal.
>
> This seems more like a pinmux'ing issue than a GPIO. This isn't really
> a GPIO if it is routed to a h/w control.

Sorry, muxing part (e.g. PA11, PB11...) isn't shown in above scheme.
GPIO is muxed via gpio/pinctrl driver.

>
> A -gpios property for a trigger would make sense if you had a driver
> handling GPIO interrupts to generate IIO triggers. This seems to be
> just mux control.

This is almost it, there are two stages.
- trigger starts conversion on device (e.g. ADC...) by hardware (no need 
for interrupt on 1st stage, data isn't ready anyway).
- 2nd stage, end of conversion polls the trigger.

Just to summarize, rephrase, in case push button is used to trigger 
conversions:
- 1st declare GPIO (to which push button is connected)
- GPIO is muxed into external interrupt (e.g. EXTI) by using pinctrl
and exti driver. This may be compared to a 'gpio_keys' up to this point.
- EXTI line is able to either generate an interrupt (not used here)
and/or start conversion as trigger line (that is used here).
- end of conversion does the actual trigger poll.

>
>>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>>> source
>>>
>>>
>>> -gpios is the preferred form.
>>
>>
>> I apologize, I didn't make it clear in the first place. Please let me
>> rephrase. Is bellow description more suitable ?
>
> What I mean is the property name is wrong. It should be "extiN-gpios".
Oh... got it, thanks.
I'll update this.

Best Regards,
Fabrice
>
>>
>> - extiN-gpio: One or several named GPIO lines that may be used as
>>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>>   trig DAC.
>>
>>>
>>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>>> stm32f4).
>>>> +
>>>> +Example:
>>>> +       triggers {
>>>> +               compatible = "st,stm32-exti-trigger";
>>>> +               exti11-gpio=<&gpioa 11 0>;
>>>
>>>
>>> spaces around the "=".
>>
>> I'll fix it in V2, and also add example for more that one EXTI trigger:
>>
>>         triggers {
>>                 compatible = "st,stm32-exti-trigger";
>>                 exti9-gpio = <&gpioa 9 0>;
>>                 exti11-gpio = <&gpioa 11 0>;
>>                 ...
>>         };
>>
>> Above binding can typically be used in board dt, in case on-board gpio is
>> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>>
>> Please let me know if this clarifies, so I'll do necessary changes in V2.
>>
>> Many thanks for your review.
>> Best Regards,
>> Fabrice
>>
>>>
>>>> +       };
>>>> --
>>>> 1.9.1
>>>>
>>

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 10:37           ` Fabrice Gasnier
  0 siblings, 0 replies; 39+ messages in thread
From: Fabrice Gasnier @ 2017-02-03 10:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/02/2017 04:45 PM, Rob Herring wrote:
> +Linus W
>
> On Thu, Feb 2, 2017 at 3:19 AM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
>> On 02/01/2017 05:35 PM, Rob Herring wrote:
>>>
>>> On Mon, Jan 30, 2017 at 02:57:41PM +0100, Fabrice Gasnier wrote:
>>>>
>>>> Add dt documentation for st,stm32-exti-trigger.
>>>> EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> IPs (e.g. for ADC or DAC conversions).
>>>
>>>
>>> Please use "dt-bindings: iio:" for the subject prefix.
>>
>>
>> Hi Rob,
>>
>> I'll fix this in V2.
>>
>>>
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> ---
>>>>  .../bindings/iio/trigger/st,stm32-exti-trigger.txt      | 17
>>>> +++++++++++++++++
>>>>  1 file changed, 17 insertions(+)
>>>>  create mode 100644
>>>> Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>>
>>>> diff --git
>>>> a/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> new file mode 100644
>>>> index 0000000..ebf2645
>>>> --- /dev/null
>>>> +++
>>>> b/Documentation/devicetree/bindings/iio/trigger/st,stm32-exti-trigger.txt
>>>> @@ -0,0 +1,17 @@
>>>> +STMicroelectronics STM32 EXTI trigger bindings
>>>> +
>>>> +EXTi gpio signal can be routed internally as trigger source for various
>>>
>>>
>>> s/gpio/GPIO/
>>>
>>>> +IPs (e.g. for ADC or DAC conversions).
>>>> +
>>>> +Contents of a stm32 exti trigger root node:
>>>
>>>
>>> Drop "root"
>>
>> I'll fix these in V2.
>>
>>>
>>>> +-------------------------------------------
>>>> +Required properties:
>>>> +- compatible: Should be "st,stm32-exti-trigger"
>>>
>>>
>>> This whole binding looks a bit suspicious. Is this actually a h/w block?
>>> What makes it stm32 specific? Seems like the gpio properties should just
>>> be part of the ADC or DAC that they trigger.
>>
>>
>> Please let me explain in more details.
>> I think best is I add following documentation in binding. Something like:
>>
>> GPIO + EXTI controller side | ADC side (input trigger MUX, same for DAC)
>>                             |
>>        IIO trigger         --->         IIO device
>>                             |                  __________
>>                             |          inX  --|          \
>>                             |          ...  --|  SAR ADC  |-->
>>         __                  |         __      |__________/
>> PA11 --|  \                 | TIMx --|  \   trigger   ^
>> PB11 --|   |                  ...  --|   }----------->'
>> ...  --|   }---- EXTI11 ---------->--|__/
>>      --|   |                |
>> PJ11 --|__/                 |
>>
>> In fact, this driver configures GPIO and EXTI controllers (left side of
>> above scheme), and it registers corresponding trigger in IIO. Then it can be
>> used by other IPs registered as IIO devices.
>>
>> I think this should be outside of ADC or DAC IIO device drivers, to live in
>> separate IIO trigger driver. It will avoid duplicating code (e.g. PATCH 4)
>> into several IIO device drivers.
>>
>> Is it ok to declare this as separate IIO trigger driver?
>
> Drivers and DT nodes are not necessarily 1 to 1.
Hi Rob,

Sorry, I don't get it. Can you clarify ?

>
> What controls the GPIO line that is used for the trigger?

This can be anything connected to GPIO line, such as (on board)
push-button, external synchronization signal ...

>
>> Maybe Jonathan could also advise on this ?
>>
>> As I see it, this is stm32 specific, as any GPIO bank, (e.g. PA11,
>> PB11...) can be selected to generate (EXTI11) hardware trigger signal.
>
> This seems more like a pinmux'ing issue than a GPIO. This isn't really
> a GPIO if it is routed to a h/w control.

Sorry, muxing part (e.g. PA11, PB11...) isn't shown in above scheme.
GPIO is muxed via gpio/pinctrl driver.

>
> A -gpios property for a trigger would make sense if you had a driver
> handling GPIO interrupts to generate IIO triggers. This seems to be
> just mux control.

This is almost it, there are two stages.
- trigger starts conversion on device (e.g. ADC...) by hardware (no need 
for interrupt on 1st stage, data isn't ready anyway).
- 2nd stage, end of conversion polls the trigger.

Just to summarize, rephrase, in case push button is used to trigger 
conversions:
- 1st declare GPIO (to which push button is connected)
- GPIO is muxed into external interrupt (e.g. EXTI) by using pinctrl
and exti driver. This may be compared to a 'gpio_keys' up to this point.
- EXTI line is able to either generate an interrupt (not used here)
and/or start conversion as trigger line (that is used here).
- end of conversion does the actual trigger poll.

>
>>>> +- extiN-gpio: optional gpio line that may be used as external trigger
>>>> source
>>>
>>>
>>> -gpios is the preferred form.
>>
>>
>> I apologize, I didn't make it clear in the first place. Please let me
>> rephrase. Is bellow description more suitable ?
>
> What I mean is the property name is wrong. It should be "extiN-gpios".
Oh... got it, thanks.
I'll update this.

Best Regards,
Fabrice
>
>>
>> - extiN-gpio: One or several named GPIO lines that may be used as
>>   external trigger source by STM32 ADC, DAC. N may be 0..15.
>>   For example, on stm32f4, exti11-gpio can trig ADC, exti9-gpio can
>>   trig DAC.
>>
>>>
>>>> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on
>>>> stm32f4).
>>>> +
>>>> +Example:
>>>> +       triggers {
>>>> +               compatible = "st,stm32-exti-trigger";
>>>> +               exti11-gpio=<&gpioa 11 0>;
>>>
>>>
>>> spaces around the "=".
>>
>> I'll fix it in V2, and also add example for more that one EXTI trigger:
>>
>>         triggers {
>>                 compatible = "st,stm32-exti-trigger";
>>                 exti9-gpio = <&gpioa 9 0>;
>>                 exti11-gpio = <&gpioa 11 0>;
>>                 ...
>>         };
>>
>> Above binding can typically be used in board dt, in case on-board gpio is
>> connected/used as trigger source for IIO device (STM32 ADC/DAC).
>>
>> Please let me know if this clarifies, so I'll do necessary changes in V2.
>>
>> Many thanks for your review.
>> Best Regards,
>> Fabrice
>>
>>>
>>>> +       };
>>>> --
>>>> 1.9.1
>>>>
>>

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 19:11     ` Linus Walleij
  0 siblings, 0 replies; 39+ messages in thread
From: Linus Walleij @ 2017-02-03 19:11 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: Jonathan Cameron, Russell King, Rob Herring, linux-arm-kernel,
	devicetree, linux-kernel, Mark Rutland, Benjamin Gaignard,
	Lars-Peter Clausen, Alexandre TORGUE, linux-iio, Peter Meerwald,
	Maxime Coquelin, Hartmut Knaack, Benjamin Gaignard

On Mon, Jan 30, 2017 at 2:57 PM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various
> IPs (e.g. for ADC or DAC conversions).

And you say this is done using pin control, elsewhere in the conversation
if I understand it correctly?

> +Contents of a stm32 exti trigger root node:
> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"
> +- extiN-gpio: optional gpio line that may be used as external trigger source
> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +       triggers {
> +               compatible = "st,stm32-exti-trigger";
> +               exti11-gpio=<&gpioa 11 0>;
> +       };

So what I do not understand i if this has any stm32-specific behaviour at all,
so that compatible-string has any meaning.

Should we not rather define compatible = "gpio-trigger"; to be used by
everyone? Especially for the device tree?

If it's "mostly generic, a bit specific too" it should likely be:

compatible = "gpio-trigger", "st,stm32-exit-trigger";

Yours,
Linus Walleij

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 19:11     ` Linus Walleij
  0 siblings, 0 replies; 39+ messages in thread
From: Linus Walleij @ 2017-02-03 19:11 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: Jonathan Cameron, Russell King, Rob Herring,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Rutland,
	Benjamin Gaignard, Lars-Peter Clausen, Alexandre TORGUE,
	linux-iio-u79uwXL29TY76Z2rM5mHXA, Peter Meerwald,
	Maxime Coquelin, Hartmut Knaack, Benjamin Gaignard

On Mon, Jan 30, 2017 at 2:57 PM, Fabrice Gasnier <fabrice.gasnier-qxv4g6HH51o@public.gmane.org> wrote:

> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various
> IPs (e.g. for ADC or DAC conversions).

And you say this is done using pin control, elsewhere in the conversation
if I understand it correctly?

> +Contents of a stm32 exti trigger root node:
> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"
> +- extiN-gpio: optional gpio line that may be used as external trigger source
> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +       triggers {
> +               compatible = "st,stm32-exti-trigger";
> +               exti11-gpio=<&gpioa 11 0>;
> +       };

So what I do not understand i if this has any stm32-specific behaviour at all,
so that compatible-string has any meaning.

Should we not rather define compatible = "gpio-trigger"; to be used by
everyone? Especially for the device tree?

If it's "mostly generic, a bit specific too" it should likely be:

compatible = "gpio-trigger", "st,stm32-exit-trigger";

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 19:11     ` Linus Walleij
  0 siblings, 0 replies; 39+ messages in thread
From: Linus Walleij @ 2017-02-03 19:11 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: Jonathan Cameron, Russell King, Rob Herring, linux-arm-kernel,
	devicetree, linux-kernel, Mark Rutland, Benjamin Gaignard,
	Lars-Peter Clausen, Alexandre TORGUE, linux-iio, Peter Meerwald,
	Maxime Coquelin, Hartmut Knaack, Benjamin Gaignard

On Mon, Jan 30, 2017 at 2:57 PM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various
> IPs (e.g. for ADC or DAC conversions).

And you say this is done using pin control, elsewhere in the conversation
if I understand it correctly?

> +Contents of a stm32 exti trigger root node:
> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"
> +- extiN-gpio: optional gpio line that may be used as external trigger source
> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +       triggers {
> +               compatible = "st,stm32-exti-trigger";
> +               exti11-gpio=<&gpioa 11 0>;
> +       };

So what I do not understand i if this has any stm32-specific behaviour at all,
so that compatible-string has any meaning.

Should we not rather define compatible = "gpio-trigger"; to be used by
everyone? Especially for the device tree?

If it's "mostly generic, a bit specific too" it should likely be:

compatible = "gpio-trigger", "st,stm32-exit-trigger";

Yours,
Linus Walleij

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

* [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger
@ 2017-02-03 19:11     ` Linus Walleij
  0 siblings, 0 replies; 39+ messages in thread
From: Linus Walleij @ 2017-02-03 19:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 30, 2017 at 2:57 PM, Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> Add dt documentation for st,stm32-exti-trigger.
> EXTi gpio signal can be routed internally as trigger source for various
> IPs (e.g. for ADC or DAC conversions).

And you say this is done using pin control, elsewhere in the conversation
if I understand it correctly?

> +Contents of a stm32 exti trigger root node:
> +-------------------------------------------
> +Required properties:
> +- compatible: Should be "st,stm32-exti-trigger"
> +- extiN-gpio: optional gpio line that may be used as external trigger source
> +  (e.g. N may be 0..15. For example, exti11-gpio can trig ADC on stm32f4).
> +
> +Example:
> +       triggers {
> +               compatible = "st,stm32-exti-trigger";
> +               exti11-gpio=<&gpioa 11 0>;
> +       };

So what I do not understand i if this has any stm32-specific behaviour at all,
so that compatible-string has any meaning.

Should we not rather define compatible = "gpio-trigger"; to be used by
everyone? Especially for the device tree?

If it's "mostly generic, a bit specific too" it should likely be:

compatible = "gpio-trigger", "st,stm32-exit-trigger";

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-02-03 19:11 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30 13:57 [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC Fabrice Gasnier
2017-01-30 13:57 ` Fabrice Gasnier
2017-01-30 13:57 ` Fabrice Gasnier
2017-01-30 13:57 ` [PATCH 1/5] Documentation: dt: iio: document stm32 adc trigger polarity Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57 ` [PATCH 2/5] iio: adc: stm32: add dt option to set default " Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57 ` [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-02-01 16:35   ` Rob Herring
2017-02-01 16:35     ` Rob Herring
2017-02-01 16:35     ` Rob Herring
2017-02-02  9:19     ` Fabrice Gasnier
2017-02-02  9:19       ` Fabrice Gasnier
2017-02-02  9:19       ` Fabrice Gasnier
2017-02-02 15:45       ` Rob Herring
2017-02-02 15:45         ` Rob Herring
2017-02-02 15:45         ` Rob Herring
2017-02-02 15:45         ` Rob Herring
2017-02-03 10:37         ` Fabrice Gasnier
2017-02-03 10:37           ` Fabrice Gasnier
2017-02-03 10:37           ` Fabrice Gasnier
2017-02-03 10:37           ` Fabrice Gasnier
2017-02-03 19:11   ` Linus Walleij
2017-02-03 19:11     ` Linus Walleij
2017-02-03 19:11     ` Linus Walleij
2017-02-03 19:11     ` Linus Walleij
2017-01-30 13:57 ` [PATCH 4/5] iio: trigger: add support for STM32 EXTI triggers Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57 ` [PATCH 5/5] iio: adc: stm32: add exti11 gpio trigger source Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 13:57   ` Fabrice Gasnier
2017-01-30 14:09 ` [PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC Fabrice Gasnier
2017-01-30 14:09   ` Fabrice Gasnier
2017-01-30 14:09   ` Fabrice Gasnier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.