Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569840

[PATCH 2/5] iio: adc: stm32: add dt option to set default trigger polarity

From Fabrice Gasnier <fabrice.gasnier@st.com>
Newsgroups linux.kernel
Subject [PATCH 2/5] iio: adc: stm32: add dt option to set default trigger polarity
Date 2017-01-30 16:40 +0100
Message-ID <t5mdI-5F2-27@gated-at.bofh.it> (permalink)
References <t5kOB-4Wr-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] Add EXTI GPIO trigger support to STM32 ADC Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 15:30 +0100
  [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 15:50 +0100
    Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Rob Herring <robh@kernel.org> - 2017-02-01 17:40 +0100
      Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-02-02 10:30 +0100
        Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Rob Herring <robh@kernel.org> - 2017-02-02 16:50 +0100
          Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-02-03 11:40 +0100
    Re: [PATCH 3/5] Documentation: dt: iio: document stm32 exti trigger Linus Walleij <linus.walleij@linaro.org> - 2017-02-03 20:20 +0100
  [PATCH 2/5] iio: adc: stm32: add dt option to set default trigger polarity Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-01-30 16:40 +0100

csiph-web