Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569780 > unrolled thread
| Started by | Fabrice Gasnier <fabrice.gasnier@st.com> |
|---|---|
| First post | 2017-01-30 15:40 +0100 |
| Last post | 2017-01-30 17:00 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/5] Add EXTI GPIO trigger support to STM32 ADC Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 15:40 +0100
[PATCH v2 2/5] iio: adc: stm32: add dt option to set default trigger polarity Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 15:40 +0100
[PATCH v2 3/5] Documentation: dt: iio: document stm32 exti trigger Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 15:40 +0100
[PATCH v2 1/5] Documentation: dt: iio: document stm32 adc trigger polarity Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 15:40 +0100
Re: [PATCH v2 1/5] Documentation: dt: iio: document stm32 adc trigger polarity Jonathan Cameron <jic23@kernel.org> - 2017-02-05 11:00 +0100
[PATCH v2 5/5] iio: adc: stm32: add exti gpio trigger source Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 17:00 +0100
| From | Fabrice Gasnier <fabrice.gasnier@st.com> |
|---|---|
| Date | 2017-01-30 15:40 +0100 |
| Subject | [PATCH v2 0/5] Add EXTI GPIO trigger support to STM32 ADC |
| Message-ID | <t5lhD-55I-9@gated-at.bofh.it> |
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. --- Changes in V2: - Fixed Kconfig dependencies 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 exti 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 | 11 ++ 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, 196 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
[toc] | [next] | [standalone]
| From | Fabrice Gasnier <fabrice.gasnier@st.com> |
|---|---|
| Date | 2017-01-30 15:40 +0100 |
| Subject | [PATCH v2 2/5] iio: adc: stm32: add dt option to set default trigger polarity |
| Message-ID | <t5lhD-55I-13@gated-at.bofh.it> |
| In reply to | #1569780 |
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
[toc] | [prev] | [next] | [standalone]
| From | Fabrice Gasnier <fabrice.gasnier@st.com> |
|---|---|
| Date | 2017-01-30 15:40 +0100 |
| Subject | [PATCH v2 3/5] Documentation: dt: iio: document stm32 exti trigger |
| Message-ID | <t5lhE-55I-27@gated-at.bofh.it> |
| In reply to | #1569780 |
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
[toc] | [prev] | [next] | [standalone]
| From | Fabrice Gasnier <fabrice.gasnier@st.com> |
|---|---|
| Date | 2017-01-30 15:40 +0100 |
| Subject | [PATCH v2 1/5] Documentation: dt: iio: document stm32 adc trigger polarity |
| Message-ID | <t5lhE-55I-23@gated-at.bofh.it> |
| In reply to | #1569780 |
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
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-02-05 11:00 +0100 |
| Subject | Re: [PATCH v2 1/5] Documentation: dt: iio: document stm32 adc trigger polarity |
| Message-ID | <t7rLY-5CS-5@gated-at.bofh.it> |
| In reply to | #1569786 |
On 30/01/17 14:33, Fabrice Gasnier wrote:
> 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>
This falls into the same question of whether this is really an interrupt
(be it one that linux can't see) or not.
It certainly similar enough I'd like to see us use as much of the
interrupt bindings as possible rather than reinventing the wheel.
cc'd Thomas Gleixner.
Thomas, what we have here effectively an interrupt that we have the option
to directly route to the hardware block to initialize an ADC sample
(rather than bouncing through the kernel). It can also be directly
exposed as a real interrupt and the chances are we are going to end
up with a mixture of the two depending on who is interesting in the
'interrupt'.
Any thoughts?
Jonathan
> ---
> 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...
>
[toc] | [prev] | [next] | [standalone]
| From | Fabrice Gasnier <fabrice.gasnier@st.com> |
|---|---|
| Date | 2017-01-30 17:00 +0100 |
| Subject | [PATCH v2 5/5] iio: adc: stm32: add exti gpio trigger source |
| Message-ID | <t5mx3-5LI-7@gated-at.bofh.it> |
| In reply to | #1569780 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web