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


Groups > linux.kernel > #1671725 > unrolled thread

[PATCH v2 0/8] Add STM32 LPTimer: PWM, trigger and counter

Started byFabrice Gasnier <fabrice.gasnier@st.com>
First post2017-06-21 16:40 +0200
Last post2017-06-30 20:30 +0200
Articles 14 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/8] Add STM32 LPTimer: PWM, trigger and counter Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-21 16:40 +0200
    [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-21 16:40 +0200
      Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Jonathan Cameron <jic23@kernel.org> - 2017-06-21 22:10 +0200
      Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Lee Jones <lee.jones@linaro.org> - 2017-06-22 17:50 +0200
      Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Rob Herring <robh@kernel.org> - 2017-06-26 20:10 +0200
        Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-27 11:10 +0200
          Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Rob Herring <robh@kernel.org> - 2017-06-28 20:00 +0200
            Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-29 09:20 +0200
    [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-21 16:40 +0200
      Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver Jonathan Cameron <jic23@kernel.org> - 2017-06-24 22:20 +0200
        Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-26 18:50 +0200
          Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver Jonathan Cameron <jic23@kernel.org> - 2017-06-30 16:00 +0200
            Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver Fabrice Gasnier <fabrice.gasnier@st.com> - 2017-06-30 18:30 +0200
              Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver Jonathan Cameron <jic23@kernel.org> - 2017-06-30 20:30 +0200

#1671725 — [PATCH v2 0/8] Add STM32 LPTimer: PWM, trigger and counter

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-21 16:40 +0200
Subject[PATCH v2 0/8] Add STM32 LPTimer: PWM, trigger and counter
Message-ID<tUOXv-7i3-3@gated-at.bofh.it>
This series adds support for Low-Power Timer that can be found on
some STM32 devices.

STM32 LPTimer (LPTIM) is a 16-bit timer that provides several
functionalities. This series adds support for following features:
- PWM output (with programmable prescaler, configurable polarity)
- Trigger source for STM32 ADC or DAC (LPTIM_OUT)
- Quadrature encoder and counter

The MFD core is used to manage common resources (clock, register map)
and to detect encoder feature. "stm32_lptimer" structure is provided
to its sub-nodes to share those information:
- PWM driver is used to implement single PWM channel
- IIO trigger
- IIO quadrature encoder and counter

---
Changes in v2:
- Various remarks from Lee, on MFD part, extended to the full series,
  such as: clock name, use "Low-Power Timer", file headers, dt-bindings
  props descriptions, fix dt example.

Fabrice Gasnier (8):
  dt-bindings: mfd: Add STM32 LPTimer binding
  mfd: Add STM32 LPTimer driver
  dt-bindings: pwm: Add STM32 LPTimer PWM binding
  pwm: Add STM32 LPTimer PWM driver
  dt-bindings: iio: Add STM32 LPTimer trigger binding
  iio: trigger: Add STM32 LPTimer trigger driver
  dt-bindings: iio: Add STM32 LPTimer quadrature encoder and counter
  iio: counter: Add support for STM32 LPTimer

 .../ABI/testing/sysfs-bus-iio-lptimer-stm32        |  57 +++
 .../bindings/iio/counter/stm32-lptimer-cnt.txt     |  27 ++
 .../bindings/iio/timer/stm32-lptimer-trigger.txt   |  23 ++
 .../devicetree/bindings/mfd/stm32-lptimer.txt      |  48 +++
 .../devicetree/bindings/pwm/pwm-stm32-lp.txt       |  24 ++
 drivers/iio/counter/Kconfig                        |   9 +
 drivers/iio/counter/Makefile                       |   1 +
 drivers/iio/counter/stm32-lptimer-cnt.c            | 383 +++++++++++++++++++++
 drivers/iio/trigger/Kconfig                        |  11 +
 drivers/iio/trigger/Makefile                       |   1 +
 drivers/iio/trigger/stm32-lptimer-trigger.c        | 110 ++++++
 drivers/mfd/Kconfig                                |  14 +
 drivers/mfd/Makefile                               |   1 +
 drivers/mfd/stm32-lptimer.c                        | 107 ++++++
 drivers/pwm/Kconfig                                |  10 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-stm32-lp.c                         | 216 ++++++++++++
 include/linux/iio/timer/stm32-lptim-trigger.h      |  24 ++
 include/linux/mfd/stm32-lptimer.h                  |  62 ++++
 19 files changed, 1129 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32
 create mode 100644 Documentation/devicetree/bindings/iio/counter/stm32-lptimer-cnt.txt
 create mode 100644 Documentation/devicetree/bindings/iio/timer/stm32-lptimer-trigger.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-stm32-lp.txt
 create mode 100644 drivers/iio/counter/stm32-lptimer-cnt.c
 create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
 create mode 100644 drivers/mfd/stm32-lptimer.c
 create mode 100644 drivers/pwm/pwm-stm32-lp.c
 create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h
 create mode 100644 include/linux/mfd/stm32-lptimer.h

-- 
1.9.1

[toc] | [next] | [standalone]


#1671730 — [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-21 16:40 +0200
Subject[PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tUOXx-7i3-61@gated-at.bofh.it>
In reply to#1671725
Add documentation for STMicroelectronics STM32 Low-Power Timer binding.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
Changes in v2:
- Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
  properties descriptions
---
 .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt

diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
new file mode 100644
index 0000000..af859c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
@@ -0,0 +1,48 @@
+STMicroelectronics STM32 Low-Power Timer
+
+The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
+functions:
+- PWM output (with programmable prescaler, configurable polarity)
+- Quadrature encoder, counter
+- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
+
+Required properties:
+- compatible:		Must be "st,stm32-lptimer".
+- reg:			Offset and length of the device's register set.
+- clocks:		Phandle to the clock used by the LP Timer module.
+- clock-names:		Must be "mux".
+- #address-cells:	Should be '<1>'.
+- #size-cells:		Should be '<0>'.
+
+Optional subnodes:
+- pwm:			See ../pwm/pwm-stm32-lp.txt
+- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
+- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
+
+Example:
+
+	lptimer1: lptimer@40002400 {
+		compatible = "st,stm32-lptimer";
+		reg = <0x40002400 0x400>;
+		clocks = <&timer_clk>;
+		clock-names = "mux";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pwm {
+			compatible = "st,stm32-pwm-lp";
+			pinctrl-names = "default";
+			pinctrl-0 = <&lppwm1_pins>;
+		};
+
+		trigger@0 {
+			compatible = "st,stm32-lptimer-trigger";
+			reg = <0>;
+		};
+
+		counter {
+			compatible = "st,stm32-lptimer-counter";
+			pinctrl-names = "default";
+			pinctrl-0 = <&lptim1_in_pins>;
+		};
+	};
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1672000 — Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromJonathan Cameron <jic23@kernel.org>
Date2017-06-21 22:10 +0200
SubjectRe: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tUU6S-2DB-25@gated-at.bofh.it>
In reply to#1671730
On Wed, 21 Jun 2017 16:30:08 +0200
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> Add documentation for STMicroelectronics STM32 Low-Power Timer binding.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Looks sensible to me.

Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> Changes in v2:
> - Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
>   properties descriptions
> ---
>  .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> new file mode 100644
> index 0000000..af859c8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> @@ -0,0 +1,48 @@
> +STMicroelectronics STM32 Low-Power Timer
> +
> +The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
> +functions:
> +- PWM output (with programmable prescaler, configurable polarity)
> +- Quadrature encoder, counter
> +- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
> +
> +Required properties:
> +- compatible:		Must be "st,stm32-lptimer".
> +- reg:			Offset and length of the device's register set.
> +- clocks:		Phandle to the clock used by the LP Timer module.
> +- clock-names:		Must be "mux".
> +- #address-cells:	Should be '<1>'.
> +- #size-cells:		Should be '<0>'.
> +
> +Optional subnodes:
> +- pwm:			See ../pwm/pwm-stm32-lp.txt
> +- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
> +- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
> +
> +Example:
> +
> +	lptimer1: lptimer@40002400 {
> +		compatible = "st,stm32-lptimer";
> +		reg = <0x40002400 0x400>;
> +		clocks = <&timer_clk>;
> +		clock-names = "mux";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		pwm {
> +			compatible = "st,stm32-pwm-lp";
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&lppwm1_pins>;
> +		};
> +
> +		trigger@0 {
> +			compatible = "st,stm32-lptimer-trigger";
> +			reg = <0>;
> +		};
> +
> +		counter {
> +			compatible = "st,stm32-lptimer-counter";
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&lptim1_in_pins>;
> +		};
> +	};

[toc] | [prev] | [next] | [standalone]


#1672760 — Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromLee Jones <lee.jones@linaro.org>
Date2017-06-22 17:50 +0200
SubjectRe: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tVcwO-6Is-3@gated-at.bofh.it>
In reply to#1671730
On Wed, 21 Jun 2017, Fabrice Gasnier wrote:

> Add documentation for STMicroelectronics STM32 Low-Power Timer binding.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
> Changes in v2:
> - Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
>   properties descriptions
> ---
>  .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
  
> diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> new file mode 100644
> index 0000000..af859c8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> @@ -0,0 +1,48 @@
> +STMicroelectronics STM32 Low-Power Timer
> +
> +The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
> +functions:
> +- PWM output (with programmable prescaler, configurable polarity)
> +- Quadrature encoder, counter
> +- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
> +
> +Required properties:
> +- compatible:		Must be "st,stm32-lptimer".
> +- reg:			Offset and length of the device's register set.
> +- clocks:		Phandle to the clock used by the LP Timer module.
> +- clock-names:		Must be "mux".
> +- #address-cells:	Should be '<1>'.
> +- #size-cells:		Should be '<0>'.
> +
> +Optional subnodes:
> +- pwm:			See ../pwm/pwm-stm32-lp.txt
> +- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
> +- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
> +
> +Example:
> +
> +	lptimer1: lptimer@40002400 {
> +		compatible = "st,stm32-lptimer";
> +		reg = <0x40002400 0x400>;
> +		clocks = <&timer_clk>;
> +		clock-names = "mux";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		pwm {
> +			compatible = "st,stm32-pwm-lp";
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&lppwm1_pins>;
> +		};
> +
> +		trigger@0 {
> +			compatible = "st,stm32-lptimer-trigger";
> +			reg = <0>;
> +		};
> +
> +		counter {
> +			compatible = "st,stm32-lptimer-counter";
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&lptim1_in_pins>;
> +		};
> +	};

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1674984 — Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromRob Herring <robh@kernel.org>
Date2017-06-26 20:10 +0200
SubjectRe: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tWGCt-5HI-13@gated-at.bofh.it>
In reply to#1671730
On Wed, Jun 21, 2017 at 04:30:08PM +0200, Fabrice Gasnier wrote:
> Add documentation for STMicroelectronics STM32 Low-Power Timer binding.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> ---
> Changes in v2:
> - Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
>   properties descriptions
> ---
>  .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> new file mode 100644
> index 0000000..af859c8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> @@ -0,0 +1,48 @@
> +STMicroelectronics STM32 Low-Power Timer
> +
> +The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
> +functions:
> +- PWM output (with programmable prescaler, configurable polarity)
> +- Quadrature encoder, counter
> +- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
> +
> +Required properties:
> +- compatible:		Must be "st,stm32-lptimer".
> +- reg:			Offset and length of the device's register set.
> +- clocks:		Phandle to the clock used by the LP Timer module.
> +- clock-names:		Must be "mux".
> +- #address-cells:	Should be '<1>'.
> +- #size-cells:		Should be '<0>'.
> +
> +Optional subnodes:
> +- pwm:			See ../pwm/pwm-stm32-lp.txt
> +- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
> +- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
> +
> +Example:
> +
> +	lptimer1: lptimer@40002400 {

timer@...

> +		compatible = "st,stm32-lptimer";
> +		reg = <0x40002400 0x400>;
> +		clocks = <&timer_clk>;
> +		clock-names = "mux";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		pwm {
> +			compatible = "st,stm32-pwm-lp";
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&lppwm1_pins>;
> +		};
> +
> +		trigger@0 {
> +			compatible = "st,stm32-lptimer-trigger";
> +			reg = <0>;

Is there more than 1? 

> +		};
> +
> +		counter {
> +			compatible = "st,stm32-lptimer-counter";
> +			pinctrl-names = "default";
> +			pinctrl-0 = <&lptim1_in_pins>;
> +		};
> +	};
> -- 
> 1.9.1
> 

[toc] | [prev] | [next] | [standalone]


#1675430 — Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-27 11:10 +0200
SubjectRe: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tWUFs-6Nx-9@gated-at.bofh.it>
In reply to#1674984
On 06/26/2017 08:07 PM, Rob Herring wrote:
> On Wed, Jun 21, 2017 at 04:30:08PM +0200, Fabrice Gasnier wrote:
>> Add documentation for STMicroelectronics STM32 Low-Power Timer binding.
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>> ---
>> Changes in v2:
>> - Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
>>   properties descriptions
>> ---
>>  .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
>>  1 file changed, 48 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
>> new file mode 100644
>> index 0000000..af859c8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
>> @@ -0,0 +1,48 @@
>> +STMicroelectronics STM32 Low-Power Timer
>> +
>> +The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
>> +functions:
>> +- PWM output (with programmable prescaler, configurable polarity)
>> +- Quadrature encoder, counter
>> +- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
>> +
>> +Required properties:
>> +- compatible:		Must be "st,stm32-lptimer".
>> +- reg:			Offset and length of the device's register set.
>> +- clocks:		Phandle to the clock used by the LP Timer module.
>> +- clock-names:		Must be "mux".
>> +- #address-cells:	Should be '<1>'.
>> +- #size-cells:		Should be '<0>'.
>> +
>> +Optional subnodes:
>> +- pwm:			See ../pwm/pwm-stm32-lp.txt
>> +- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
>> +- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
>> +
>> +Example:
>> +
>> +	lptimer1: lptimer@40002400 {
> 
> timer@...

Hi Rob,

I initially put "lptimer" here to distinguish Low-Power Timer hardware
from other "timers" hardware that can be found also on stm32 devices.
I'd prefer to keep it, is it sensible from your point of view ?
Please advise.

> 
>> +		compatible = "st,stm32-lptimer";
>> +		reg = <0x40002400 0x400>;
>> +		clocks = <&timer_clk>;
>> +		clock-names = "mux";
>> +		#address-cells = <1>;
>> +		#size-cells = <0>;
>> +
>> +		pwm {
>> +			compatible = "st,stm32-pwm-lp";
>> +			pinctrl-names = "default";
>> +			pinctrl-0 = <&lppwm1_pins>;
>> +		};
>> +
>> +		trigger@0 {
>> +			compatible = "st,stm32-lptimer-trigger";
>> +			reg = <0>;
> 
> Is there more than 1? 

reg identifies trigger hardware block.

Best Regards,
Thanks,
Fabrice

> 
>> +		};
>> +
>> +		counter {
>> +			compatible = "st,stm32-lptimer-counter";
>> +			pinctrl-names = "default";
>> +			pinctrl-0 = <&lptim1_in_pins>;
>> +		};
>> +	};
>> -- 
>> 1.9.1
>>

[toc] | [prev] | [next] | [standalone]


#1676923 — Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromRob Herring <robh@kernel.org>
Date2017-06-28 20:00 +0200
SubjectRe: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tXppX-t5-63@gated-at.bofh.it>
In reply to#1675430
On Tue, Jun 27, 2017 at 10:57:32AM +0200, Fabrice Gasnier wrote:
> On 06/26/2017 08:07 PM, Rob Herring wrote:
> > On Wed, Jun 21, 2017 at 04:30:08PM +0200, Fabrice Gasnier wrote:
> >> Add documentation for STMicroelectronics STM32 Low-Power Timer binding.
> >>
> >> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> >> ---
> >> Changes in v2:
> >> - Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
> >>   properties descriptions
> >> ---
> >>  .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
> >>  1 file changed, 48 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> >> new file mode 100644
> >> index 0000000..af859c8
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
> >> @@ -0,0 +1,48 @@
> >> +STMicroelectronics STM32 Low-Power Timer
> >> +
> >> +The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
> >> +functions:
> >> +- PWM output (with programmable prescaler, configurable polarity)
> >> +- Quadrature encoder, counter
> >> +- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
> >> +
> >> +Required properties:
> >> +- compatible:		Must be "st,stm32-lptimer".
> >> +- reg:			Offset and length of the device's register set.
> >> +- clocks:		Phandle to the clock used by the LP Timer module.
> >> +- clock-names:		Must be "mux".
> >> +- #address-cells:	Should be '<1>'.
> >> +- #size-cells:		Should be '<0>'.
> >> +
> >> +Optional subnodes:
> >> +- pwm:			See ../pwm/pwm-stm32-lp.txt
> >> +- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
> >> +- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
> >> +
> >> +Example:
> >> +
> >> +	lptimer1: lptimer@40002400 {
> > 
> > timer@...
> 
> Hi Rob,
> 
> I initially put "lptimer" here to distinguish Low-Power Timer hardware
> from other "timers" hardware that can be found also on stm32 devices.
> I'd prefer to keep it, is it sensible from your point of view ?
> Please advise.

Node names are supposed to be the class of device (e.g. ethernet, 
serial, etc.), not the specific device. The compatible is what 
distinguishes it from other timers.

> >> +		compatible = "st,stm32-lptimer";
> >> +		reg = <0x40002400 0x400>;
> >> +		clocks = <&timer_clk>;
> >> +		clock-names = "mux";
> >> +		#address-cells = <1>;
> >> +		#size-cells = <0>;
> >> +
> >> +		pwm {
> >> +			compatible = "st,stm32-pwm-lp";
> >> +			pinctrl-names = "default";
> >> +			pinctrl-0 = <&lppwm1_pins>;
> >> +		};
> >> +
> >> +		trigger@0 {
> >> +			compatible = "st,stm32-lptimer-trigger";
> >> +			reg = <0>;
> > 
> > Is there more than 1? 
> 
> reg identifies trigger hardware block.

Okay, the trigger patch needs to be reworded.

Rob

[toc] | [prev] | [next] | [standalone]


#1677457 — Re: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-29 09:20 +0200
SubjectRe: [PATCH v2 1/8] dt-bindings: mfd: Add STM32 LPTimer binding
Message-ID<tXBU5-4BD-7@gated-at.bofh.it>
In reply to#1676923
On 06/28/2017 06:44 PM, Rob Herring wrote:
> On Tue, Jun 27, 2017 at 10:57:32AM +0200, Fabrice Gasnier wrote:
>> On 06/26/2017 08:07 PM, Rob Herring wrote:
>>> On Wed, Jun 21, 2017 at 04:30:08PM +0200, Fabrice Gasnier wrote:
>>>> Add documentation for STMicroelectronics STM32 Low-Power Timer binding.
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> ---
>>>> Changes in v2:
>>>> - Lee's comments: s/Low Power/Low-Power/, remove 0x in example, improve
>>>>   properties descriptions
>>>> ---
>>>>  .../devicetree/bindings/mfd/stm32-lptimer.txt      | 48 ++++++++++++++++++++++
>>>>  1 file changed, 48 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
>>>> new file mode 100644
>>>> index 0000000..af859c8
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/mfd/stm32-lptimer.txt
>>>> @@ -0,0 +1,48 @@
>>>> +STMicroelectronics STM32 Low-Power Timer
>>>> +
>>>> +The STM32 Low-Power Timer (LPTIM) is a 16-bit timer that provides several
>>>> +functions:
>>>> +- PWM output (with programmable prescaler, configurable polarity)
>>>> +- Quadrature encoder, counter
>>>> +- Trigger source for STM32 ADC/DAC (LPTIM_OUT)
>>>> +
>>>> +Required properties:
>>>> +- compatible:		Must be "st,stm32-lptimer".
>>>> +- reg:			Offset and length of the device's register set.
>>>> +- clocks:		Phandle to the clock used by the LP Timer module.
>>>> +- clock-names:		Must be "mux".
>>>> +- #address-cells:	Should be '<1>'.
>>>> +- #size-cells:		Should be '<0>'.
>>>> +
>>>> +Optional subnodes:
>>>> +- pwm:			See ../pwm/pwm-stm32-lp.txt
>>>> +- counter:		See ../iio/timer/stm32-lptimer-cnt.txt
>>>> +- trigger:		See ../iio/timer/stm32-lptimer-trigger.txt
>>>> +
>>>> +Example:
>>>> +
>>>> +	lptimer1: lptimer@40002400 {
>>>
>>> timer@...
>>
>> Hi Rob,
>>
>> I initially put "lptimer" here to distinguish Low-Power Timer hardware
>> from other "timers" hardware that can be found also on stm32 devices.
>> I'd prefer to keep it, is it sensible from your point of view ?
>> Please advise.
> 
> Node names are supposed to be the class of device (e.g. ethernet, 
> serial, etc.), not the specific device. The compatible is what 
> distinguishes it from other timers.

Hi Rob,

Thanks for your answer. I'll update this in v3.

> 
>>>> +		compatible = "st,stm32-lptimer";
>>>> +		reg = <0x40002400 0x400>;
>>>> +		clocks = <&timer_clk>;
>>>> +		clock-names = "mux";
>>>> +		#address-cells = <1>;
>>>> +		#size-cells = <0>;
>>>> +
>>>> +		pwm {
>>>> +			compatible = "st,stm32-pwm-lp";
>>>> +			pinctrl-names = "default";
>>>> +			pinctrl-0 = <&lppwm1_pins>;
>>>> +		};
>>>> +
>>>> +		trigger@0 {
>>>> +			compatible = "st,stm32-lptimer-trigger";
>>>> +			reg = <0>;
>>>
>>> Is there more than 1? 
>>
>> reg identifies trigger hardware block.
> 
> Okay, the trigger patch needs to be reworded.
> 
I'll update this in v3.

Best Regards,
Fabrice
> Rob
> 

[toc] | [prev] | [next] | [standalone]


#1671732 — [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-21 16:40 +0200
Subject[PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver
Message-ID<tUOXx-7i3-63@gated-at.bofh.it>
In reply to#1671725
Add support for LPTIMx_OUT triggers that can be found on some STM32
devices. These triggers can be used then by ADC or DAC.
Typical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)
and have synchronised analog conversions with these triggers.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
Changes in v2:
- s/Low Power/Low-Power
- update few comments
---
 drivers/iio/trigger/Kconfig                   |  11 +++
 drivers/iio/trigger/Makefile                  |   1 +
 drivers/iio/trigger/stm32-lptimer-trigger.c   | 110 ++++++++++++++++++++++++++
 include/linux/iio/timer/stm32-lptim-trigger.h |  24 ++++++
 4 files changed, 146 insertions(+)
 create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
 create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h

diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
index e4d4e63..a633d2c 100644
--- a/drivers/iio/trigger/Kconfig
+++ b/drivers/iio/trigger/Kconfig
@@ -24,6 +24,17 @@ 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_LPTIMER_TRIGGER
+	tristate "STM32 Low-Power Timer Trigger"
+	depends on MFD_STM32_LPTIMER || COMPILE_TEST
+	help
+	  Select this option to enable STM32 Low-Power Timer Trigger.
+	  This can be used as trigger source for STM32 internal ADC
+	  and/or DAC.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called stm32-lptimer-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..0a72a2a 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_LPTIMER_TRIGGER) += stm32-lptimer-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-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c
new file mode 100644
index 0000000..bcb9aa2
--- /dev/null
+++ b/drivers/iio/trigger/stm32-lptimer-trigger.c
@@ -0,0 +1,110 @@
+/*
+ * STM32 Low-Power Timer Trigger driver
+ *
+ * Copyright (C) STMicroelectronics 2017
+ *
+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
+ *
+ * License terms:  GNU General Public License (GPL), version 2
+ *
+ * Inspired by Benjamin Gaignard's stm32-timer-trigger driver
+ */
+
+#include <linux/iio/iio.h>
+#include <linux/iio/timer/stm32-lptim-trigger.h>
+#include <linux/iio/trigger.h>
+#include <linux/mfd/stm32-lptimer.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+/* List Low-Power Timer triggers */
+static const char * const stm32_lptim_triggers[] = {
+	LPTIM1_OUT,
+	LPTIM2_OUT,
+	LPTIM3_OUT,
+};
+
+struct stm32_lptim_trigger {
+	struct device *dev;
+	const char *trg;
+};
+
+static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
+	.owner = THIS_MODULE,
+};
+
+/**
+ * is_stm32_lptim_trigger
+ * @trig: trigger to be checked
+ *
+ * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger
+ * either return false
+ */
+bool is_stm32_lptim_trigger(struct iio_trigger *trig)
+{
+	return (trig->ops == &stm32_lptim_trigger_ops);
+}
+EXPORT_SYMBOL(is_stm32_lptim_trigger);
+
+static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)
+{
+	struct iio_trigger *trig;
+
+	trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg);
+	if  (!trig)
+		return -ENOMEM;
+
+	trig->dev.parent = priv->dev->parent;
+	trig->ops = &stm32_lptim_trigger_ops;
+	iio_trigger_set_drvdata(trig, priv);
+
+	return devm_iio_trigger_register(priv->dev, trig);
+}
+
+static int stm32_lptim_trigger_probe(struct platform_device *pdev)
+{
+	struct stm32_lptim_trigger *priv;
+	u32 index;
+	int ret;
+
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	if (of_property_read_u32(pdev->dev.of_node, "reg", &index))
+		return -EINVAL;
+
+	if (index >= ARRAY_SIZE(stm32_lptim_triggers))
+		return -EINVAL;
+
+	priv->dev = &pdev->dev;
+	priv->trg = stm32_lptim_triggers[index];
+
+	ret = stm32_lptim_setup_trig(priv);
+	if (ret)
+		return ret;
+
+	platform_set_drvdata(pdev, priv);
+
+	return 0;
+}
+
+static const struct of_device_id stm32_lptim_trig_of_match[] = {
+	{ .compatible = "st,stm32-lptimer-trigger", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);
+
+static struct platform_driver stm32_lptim_trigger_driver = {
+	.probe = stm32_lptim_trigger_probe,
+	.driver = {
+		.name = "stm32-lptimer-trigger",
+		.of_match_table = stm32_lptim_trig_of_match,
+	},
+};
+module_platform_driver(stm32_lptim_trigger_driver);
+
+MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
+MODULE_ALIAS("platform:stm32-lptimer-trigger");
+MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
new file mode 100644
index 0000000..cb795b1
--- /dev/null
+++ b/include/linux/iio/timer/stm32-lptim-trigger.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) STMicroelectronics 2017
+ *
+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>
+ *
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#ifndef _STM32_LPTIM_TRIGGER_H_
+#define _STM32_LPTIM_TRIGGER_H_
+
+#define LPTIM1_OUT	"lptim1_out"
+#define LPTIM2_OUT	"lptim2_out"
+#define LPTIM3_OUT	"lptim3_out"
+
+#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
+bool is_stm32_lptim_trigger(struct iio_trigger *trig);
+#else
+static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
+{
+	return false;
+}
+#endif
+#endif
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1674141 — Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver

FromJonathan Cameron <jic23@kernel.org>
Date2017-06-24 22:20 +0200
SubjectRe: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver
Message-ID<tVZHb-3U2-7@gated-at.bofh.it>
In reply to#1671732
On Wed, 21 Jun 2017 16:30:13 +0200
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> Add support for LPTIMx_OUT triggers that can be found on some STM32
> devices. These triggers can be used then by ADC or DAC.
> Typical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)
> and have synchronised analog conversions with these triggers.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Given this can't be used as a trigger for other devices (no exposed
interrupt?) I'd expect to see a validate_device callback provided for
the trigger ops.  That would prevent other devices trying to use it.

Otherwise, looks good.

Jonathan
> ---
> Changes in v2:
> - s/Low Power/Low-Power
> - update few comments
> ---
>  drivers/iio/trigger/Kconfig                   |  11 +++
>  drivers/iio/trigger/Makefile                  |   1 +
>  drivers/iio/trigger/stm32-lptimer-trigger.c   | 110 ++++++++++++++++++++++++++
>  include/linux/iio/timer/stm32-lptim-trigger.h |  24 ++++++
>  4 files changed, 146 insertions(+)
>  create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
>  create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h
> 
> diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
> index e4d4e63..a633d2c 100644
> --- a/drivers/iio/trigger/Kconfig
> +++ b/drivers/iio/trigger/Kconfig
> @@ -24,6 +24,17 @@ 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_LPTIMER_TRIGGER
> +	tristate "STM32 Low-Power Timer Trigger"
> +	depends on MFD_STM32_LPTIMER || COMPILE_TEST
> +	help
> +	  Select this option to enable STM32 Low-Power Timer Trigger.
> +	  This can be used as trigger source for STM32 internal ADC
> +	  and/or DAC.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called stm32-lptimer-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..0a72a2a 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_LPTIMER_TRIGGER) += stm32-lptimer-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-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c
> new file mode 100644
> index 0000000..bcb9aa2
> --- /dev/null
> +++ b/drivers/iio/trigger/stm32-lptimer-trigger.c
> @@ -0,0 +1,110 @@
> +/*
> + * STM32 Low-Power Timer Trigger driver
> + *
> + * Copyright (C) STMicroelectronics 2017
> + *
> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
> + *
> + * License terms:  GNU General Public License (GPL), version 2
> + *
> + * Inspired by Benjamin Gaignard's stm32-timer-trigger driver
> + */
> +
> +#include <linux/iio/iio.h>
> +#include <linux/iio/timer/stm32-lptim-trigger.h>
> +#include <linux/iio/trigger.h>
> +#include <linux/mfd/stm32-lptimer.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +
> +/* List Low-Power Timer triggers */
> +static const char * const stm32_lptim_triggers[] = {
> +	LPTIM1_OUT,
> +	LPTIM2_OUT,
> +	LPTIM3_OUT,
> +};
> +
> +struct stm32_lptim_trigger {
> +	struct device *dev;
> +	const char *trg;
> +};
> +
> +static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
> +	.owner = THIS_MODULE,
> +};
> +
> +/**
> + * is_stm32_lptim_trigger
> + * @trig: trigger to be checked
> + *
> + * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger
> + * either return false
> + */
> +bool is_stm32_lptim_trigger(struct iio_trigger *trig)
> +{
> +	return (trig->ops == &stm32_lptim_trigger_ops);
> +}
> +EXPORT_SYMBOL(is_stm32_lptim_trigger);
> +
> +static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)
> +{
> +	struct iio_trigger *trig;
> +
> +	trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg);
> +	if  (!trig)
> +		return -ENOMEM;
> +
> +	trig->dev.parent = priv->dev->parent;
> +	trig->ops = &stm32_lptim_trigger_ops;
> +	iio_trigger_set_drvdata(trig, priv);
> +
> +	return devm_iio_trigger_register(priv->dev, trig);
> +}
> +
> +static int stm32_lptim_trigger_probe(struct platform_device *pdev)
> +{
> +	struct stm32_lptim_trigger *priv;
> +	u32 index;
> +	int ret;
> +
> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv)
> +		return -ENOMEM;
> +
> +	if (of_property_read_u32(pdev->dev.of_node, "reg", &index))
> +		return -EINVAL;
> +
> +	if (index >= ARRAY_SIZE(stm32_lptim_triggers))
> +		return -EINVAL;
> +
> +	priv->dev = &pdev->dev;
> +	priv->trg = stm32_lptim_triggers[index];
> +
> +	ret = stm32_lptim_setup_trig(priv);
> +	if (ret)
> +		return ret;
> +
> +	platform_set_drvdata(pdev, priv);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id stm32_lptim_trig_of_match[] = {
> +	{ .compatible = "st,stm32-lptimer-trigger", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);
> +
> +static struct platform_driver stm32_lptim_trigger_driver = {
> +	.probe = stm32_lptim_trigger_probe,
> +	.driver = {
> +		.name = "stm32-lptimer-trigger",
> +		.of_match_table = stm32_lptim_trig_of_match,
> +	},
> +};
> +module_platform_driver(stm32_lptim_trigger_driver);
> +
> +MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
> +MODULE_ALIAS("platform:stm32-lptimer-trigger");
> +MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
> new file mode 100644
> index 0000000..cb795b1
> --- /dev/null
> +++ b/include/linux/iio/timer/stm32-lptim-trigger.h
> @@ -0,0 +1,24 @@
> +/*
> + * Copyright (C) STMicroelectronics 2017
> + *
> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>
> + *
> + * License terms:  GNU General Public License (GPL), version 2
> + */
> +
> +#ifndef _STM32_LPTIM_TRIGGER_H_
> +#define _STM32_LPTIM_TRIGGER_H_
> +
> +#define LPTIM1_OUT	"lptim1_out"
> +#define LPTIM2_OUT	"lptim2_out"
> +#define LPTIM3_OUT	"lptim3_out"
> +
> +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
> +bool is_stm32_lptim_trigger(struct iio_trigger *trig);
> +#else
> +static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
> +{
> +	return false;
> +}
> +#endif
> +#endif

[toc] | [prev] | [next] | [standalone]


#1674935 — Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-26 18:50 +0200
SubjectRe: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver
Message-ID<tWFn3-4Lf-5@gated-at.bofh.it>
In reply to#1674141
On 06/24/2017 10:13 PM, Jonathan Cameron wrote:
> On Wed, 21 Jun 2017 16:30:13 +0200
> Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> 
>> Add support for LPTIMx_OUT triggers that can be found on some STM32
>> devices. These triggers can be used then by ADC or DAC.
>> Typical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)
>> and have synchronised analog conversions with these triggers.
>>
>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
> Given this can't be used as a trigger for other devices (no exposed
> interrupt?) I'd expect to see a validate_device callback provided for
> the trigger ops.  That would prevent other devices trying to use it.

Hi Jonathan,

This is something I had in mind also earlier. Only thing is...
Basically, this is limiting: when trigger poll happens on device side
(e.g. ADC), another device could use same trigger. But I admit this
looks like corner case.

I'll add it in next version, with additional patch for ADC part to
validate it's a valid device (No DAC yet).
I think I'll use INDIO_HARDWARE_TRIGGERED mode:
- in adc driver: indio_dev->modes |= INDIO_HARDWARE_TRIGGERED;
- in lptimer: if (indio_dev->modes & INDIO_HARDWARE_TRIGGERED)...

> 
> Otherwise, looks good.

Many thanks for your review.
Best Regards,
Fabrice

> 
> Jonathan
>> ---
>> Changes in v2:
>> - s/Low Power/Low-Power
>> - update few comments
>> ---
>>  drivers/iio/trigger/Kconfig                   |  11 +++
>>  drivers/iio/trigger/Makefile                  |   1 +
>>  drivers/iio/trigger/stm32-lptimer-trigger.c   | 110 ++++++++++++++++++++++++++
>>  include/linux/iio/timer/stm32-lptim-trigger.h |  24 ++++++
>>  4 files changed, 146 insertions(+)
>>  create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
>>  create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h
>>
>> diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
>> index e4d4e63..a633d2c 100644
>> --- a/drivers/iio/trigger/Kconfig
>> +++ b/drivers/iio/trigger/Kconfig
>> @@ -24,6 +24,17 @@ 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_LPTIMER_TRIGGER
>> +	tristate "STM32 Low-Power Timer Trigger"
>> +	depends on MFD_STM32_LPTIMER || COMPILE_TEST
>> +	help
>> +	  Select this option to enable STM32 Low-Power Timer Trigger.
>> +	  This can be used as trigger source for STM32 internal ADC
>> +	  and/or DAC.
>> +
>> +	  To compile this driver as a module, choose M here: the
>> +	  module will be called stm32-lptimer-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..0a72a2a 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_LPTIMER_TRIGGER) += stm32-lptimer-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-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c
>> new file mode 100644
>> index 0000000..bcb9aa2
>> --- /dev/null
>> +++ b/drivers/iio/trigger/stm32-lptimer-trigger.c
>> @@ -0,0 +1,110 @@
>> +/*
>> + * STM32 Low-Power Timer Trigger driver
>> + *
>> + * Copyright (C) STMicroelectronics 2017
>> + *
>> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
>> + *
>> + * License terms:  GNU General Public License (GPL), version 2
>> + *
>> + * Inspired by Benjamin Gaignard's stm32-timer-trigger driver
>> + */
>> +
>> +#include <linux/iio/iio.h>
>> +#include <linux/iio/timer/stm32-lptim-trigger.h>
>> +#include <linux/iio/trigger.h>
>> +#include <linux/mfd/stm32-lptimer.h>
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>> +
>> +/* List Low-Power Timer triggers */
>> +static const char * const stm32_lptim_triggers[] = {
>> +	LPTIM1_OUT,
>> +	LPTIM2_OUT,
>> +	LPTIM3_OUT,
>> +};
>> +
>> +struct stm32_lptim_trigger {
>> +	struct device *dev;
>> +	const char *trg;
>> +};
>> +
>> +static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
>> +	.owner = THIS_MODULE,
>> +};
>> +
>> +/**
>> + * is_stm32_lptim_trigger
>> + * @trig: trigger to be checked
>> + *
>> + * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger
>> + * either return false
>> + */
>> +bool is_stm32_lptim_trigger(struct iio_trigger *trig)
>> +{
>> +	return (trig->ops == &stm32_lptim_trigger_ops);
>> +}
>> +EXPORT_SYMBOL(is_stm32_lptim_trigger);
>> +
>> +static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)
>> +{
>> +	struct iio_trigger *trig;
>> +
>> +	trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg);
>> +	if  (!trig)
>> +		return -ENOMEM;
>> +
>> +	trig->dev.parent = priv->dev->parent;
>> +	trig->ops = &stm32_lptim_trigger_ops;
>> +	iio_trigger_set_drvdata(trig, priv);
>> +
>> +	return devm_iio_trigger_register(priv->dev, trig);
>> +}
>> +
>> +static int stm32_lptim_trigger_probe(struct platform_device *pdev)
>> +{
>> +	struct stm32_lptim_trigger *priv;
>> +	u32 index;
>> +	int ret;
>> +
>> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>> +	if (!priv)
>> +		return -ENOMEM;
>> +
>> +	if (of_property_read_u32(pdev->dev.of_node, "reg", &index))
>> +		return -EINVAL;
>> +
>> +	if (index >= ARRAY_SIZE(stm32_lptim_triggers))
>> +		return -EINVAL;
>> +
>> +	priv->dev = &pdev->dev;
>> +	priv->trg = stm32_lptim_triggers[index];
>> +
>> +	ret = stm32_lptim_setup_trig(priv);
>> +	if (ret)
>> +		return ret;
>> +
>> +	platform_set_drvdata(pdev, priv);
>> +
>> +	return 0;
>> +}
>> +
>> +static const struct of_device_id stm32_lptim_trig_of_match[] = {
>> +	{ .compatible = "st,stm32-lptimer-trigger", },
>> +	{},
>> +};
>> +MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);
>> +
>> +static struct platform_driver stm32_lptim_trigger_driver = {
>> +	.probe = stm32_lptim_trigger_probe,
>> +	.driver = {
>> +		.name = "stm32-lptimer-trigger",
>> +		.of_match_table = stm32_lptim_trig_of_match,
>> +	},
>> +};
>> +module_platform_driver(stm32_lptim_trigger_driver);
>> +
>> +MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
>> +MODULE_ALIAS("platform:stm32-lptimer-trigger");
>> +MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver");
>> +MODULE_LICENSE("GPL v2");
>> diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
>> new file mode 100644
>> index 0000000..cb795b1
>> --- /dev/null
>> +++ b/include/linux/iio/timer/stm32-lptim-trigger.h
>> @@ -0,0 +1,24 @@
>> +/*
>> + * Copyright (C) STMicroelectronics 2017
>> + *
>> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>
>> + *
>> + * License terms:  GNU General Public License (GPL), version 2
>> + */
>> +
>> +#ifndef _STM32_LPTIM_TRIGGER_H_
>> +#define _STM32_LPTIM_TRIGGER_H_
>> +
>> +#define LPTIM1_OUT	"lptim1_out"
>> +#define LPTIM2_OUT	"lptim2_out"
>> +#define LPTIM3_OUT	"lptim3_out"
>> +
>> +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
>> +bool is_stm32_lptim_trigger(struct iio_trigger *trig);
>> +#else
>> +static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
>> +{
>> +	return false;
>> +}
>> +#endif
>> +#endif
> 

[toc] | [prev] | [next] | [standalone]


#1678848 — Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver

FromJonathan Cameron <jic23@kernel.org>
Date2017-06-30 16:00 +0200
SubjectRe: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver
Message-ID<tY4CK-6b8-19@gated-at.bofh.it>
In reply to#1674935
On Mon, 26 Jun 2017 18:41:36 +0200
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> On 06/24/2017 10:13 PM, Jonathan Cameron wrote:
> > On Wed, 21 Jun 2017 16:30:13 +0200
> > Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> >   
> >> Add support for LPTIMx_OUT triggers that can be found on some STM32
> >> devices. These triggers can be used then by ADC or DAC.
> >> Typical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)
> >> and have synchronised analog conversions with these triggers.
> >>
> >> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>  
> > Given this can't be used as a trigger for other devices (no exposed
> > interrupt?) I'd expect to see a validate_device callback provided for
> > the trigger ops.  That would prevent other devices trying to use it.  
> 
> Hi Jonathan,
> 
> This is something I had in mind also earlier. Only thing is...
> Basically, this is limiting: when trigger poll happens on device side
> (e.g. ADC), another device could use same trigger. But I admit this
> looks like corner case.
> 
> I'll add it in next version, with additional patch for ADC part to
> validate it's a valid device (No DAC yet).
> I think I'll use INDIO_HARDWARE_TRIGGERED mode:
> - in adc driver: indio_dev->modes |= INDIO_HARDWARE_TRIGGERED;
> - in lptimer: if (indio_dev->modes & INDIO_HARDWARE_TRIGGERED)...
That may not be enough in of itself.  Could be other hardware
triggered elements on the platform (quite likely with these
stm parts!)

J
> 
> > 
> > Otherwise, looks good.  
> 
> Many thanks for your review.
> Best Regards,
> Fabrice
> 
> > 
> > Jonathan  
> >> ---
> >> Changes in v2:
> >> - s/Low Power/Low-Power
> >> - update few comments
> >> ---
> >>  drivers/iio/trigger/Kconfig                   |  11 +++
> >>  drivers/iio/trigger/Makefile                  |   1 +
> >>  drivers/iio/trigger/stm32-lptimer-trigger.c   | 110 ++++++++++++++++++++++++++
> >>  include/linux/iio/timer/stm32-lptim-trigger.h |  24 ++++++
> >>  4 files changed, 146 insertions(+)
> >>  create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
> >>  create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h
> >>
> >> diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
> >> index e4d4e63..a633d2c 100644
> >> --- a/drivers/iio/trigger/Kconfig
> >> +++ b/drivers/iio/trigger/Kconfig
> >> @@ -24,6 +24,17 @@ 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_LPTIMER_TRIGGER
> >> +	tristate "STM32 Low-Power Timer Trigger"
> >> +	depends on MFD_STM32_LPTIMER || COMPILE_TEST
> >> +	help
> >> +	  Select this option to enable STM32 Low-Power Timer Trigger.
> >> +	  This can be used as trigger source for STM32 internal ADC
> >> +	  and/or DAC.
> >> +
> >> +	  To compile this driver as a module, choose M here: the
> >> +	  module will be called stm32-lptimer-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..0a72a2a 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_LPTIMER_TRIGGER) += stm32-lptimer-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-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c
> >> new file mode 100644
> >> index 0000000..bcb9aa2
> >> --- /dev/null
> >> +++ b/drivers/iio/trigger/stm32-lptimer-trigger.c
> >> @@ -0,0 +1,110 @@
> >> +/*
> >> + * STM32 Low-Power Timer Trigger driver
> >> + *
> >> + * Copyright (C) STMicroelectronics 2017
> >> + *
> >> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
> >> + *
> >> + * License terms:  GNU General Public License (GPL), version 2
> >> + *
> >> + * Inspired by Benjamin Gaignard's stm32-timer-trigger driver
> >> + */
> >> +
> >> +#include <linux/iio/iio.h>
> >> +#include <linux/iio/timer/stm32-lptim-trigger.h>
> >> +#include <linux/iio/trigger.h>
> >> +#include <linux/mfd/stm32-lptimer.h>
> >> +#include <linux/module.h>
> >> +#include <linux/platform_device.h>
> >> +
> >> +/* List Low-Power Timer triggers */
> >> +static const char * const stm32_lptim_triggers[] = {
> >> +	LPTIM1_OUT,
> >> +	LPTIM2_OUT,
> >> +	LPTIM3_OUT,
> >> +};
> >> +
> >> +struct stm32_lptim_trigger {
> >> +	struct device *dev;
> >> +	const char *trg;
> >> +};
> >> +
> >> +static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
> >> +	.owner = THIS_MODULE,
> >> +};
> >> +
> >> +/**
> >> + * is_stm32_lptim_trigger
> >> + * @trig: trigger to be checked
> >> + *
> >> + * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger
> >> + * either return false
> >> + */
> >> +bool is_stm32_lptim_trigger(struct iio_trigger *trig)
> >> +{
> >> +	return (trig->ops == &stm32_lptim_trigger_ops);
> >> +}
> >> +EXPORT_SYMBOL(is_stm32_lptim_trigger);
> >> +
> >> +static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)
> >> +{
> >> +	struct iio_trigger *trig;
> >> +
> >> +	trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg);
> >> +	if  (!trig)
> >> +		return -ENOMEM;
> >> +
> >> +	trig->dev.parent = priv->dev->parent;
> >> +	trig->ops = &stm32_lptim_trigger_ops;
> >> +	iio_trigger_set_drvdata(trig, priv);
> >> +
> >> +	return devm_iio_trigger_register(priv->dev, trig);
> >> +}
> >> +
> >> +static int stm32_lptim_trigger_probe(struct platform_device *pdev)
> >> +{
> >> +	struct stm32_lptim_trigger *priv;
> >> +	u32 index;
> >> +	int ret;
> >> +
> >> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> >> +	if (!priv)
> >> +		return -ENOMEM;
> >> +
> >> +	if (of_property_read_u32(pdev->dev.of_node, "reg", &index))
> >> +		return -EINVAL;
> >> +
> >> +	if (index >= ARRAY_SIZE(stm32_lptim_triggers))
> >> +		return -EINVAL;
> >> +
> >> +	priv->dev = &pdev->dev;
> >> +	priv->trg = stm32_lptim_triggers[index];
> >> +
> >> +	ret = stm32_lptim_setup_trig(priv);
> >> +	if (ret)
> >> +		return ret;
> >> +
> >> +	platform_set_drvdata(pdev, priv);
> >> +
> >> +	return 0;
> >> +}
> >> +
> >> +static const struct of_device_id stm32_lptim_trig_of_match[] = {
> >> +	{ .compatible = "st,stm32-lptimer-trigger", },
> >> +	{},
> >> +};
> >> +MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);
> >> +
> >> +static struct platform_driver stm32_lptim_trigger_driver = {
> >> +	.probe = stm32_lptim_trigger_probe,
> >> +	.driver = {
> >> +		.name = "stm32-lptimer-trigger",
> >> +		.of_match_table = stm32_lptim_trig_of_match,
> >> +	},
> >> +};
> >> +module_platform_driver(stm32_lptim_trigger_driver);
> >> +
> >> +MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
> >> +MODULE_ALIAS("platform:stm32-lptimer-trigger");
> >> +MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver");
> >> +MODULE_LICENSE("GPL v2");
> >> diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
> >> new file mode 100644
> >> index 0000000..cb795b1
> >> --- /dev/null
> >> +++ b/include/linux/iio/timer/stm32-lptim-trigger.h
> >> @@ -0,0 +1,24 @@
> >> +/*
> >> + * Copyright (C) STMicroelectronics 2017
> >> + *
> >> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>
> >> + *
> >> + * License terms:  GNU General Public License (GPL), version 2
> >> + */
> >> +
> >> +#ifndef _STM32_LPTIM_TRIGGER_H_
> >> +#define _STM32_LPTIM_TRIGGER_H_
> >> +
> >> +#define LPTIM1_OUT	"lptim1_out"
> >> +#define LPTIM2_OUT	"lptim2_out"
> >> +#define LPTIM3_OUT	"lptim3_out"
> >> +
> >> +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
> >> +bool is_stm32_lptim_trigger(struct iio_trigger *trig);
> >> +#else
> >> +static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
> >> +{
> >> +	return false;
> >> +}
> >> +#endif
> >> +#endif  
> >   

[toc] | [prev] | [next] | [standalone]


#1678980 — Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver

FromFabrice Gasnier <fabrice.gasnier@st.com>
Date2017-06-30 18:30 +0200
SubjectRe: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver
Message-ID<tY6XU-7M9-25@gated-at.bofh.it>
In reply to#1678848
On 06/30/2017 03:57 PM, Jonathan Cameron wrote:
> On Mon, 26 Jun 2017 18:41:36 +0200
> Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> 
>> On 06/24/2017 10:13 PM, Jonathan Cameron wrote:
>>> On Wed, 21 Jun 2017 16:30:13 +0200
>>> Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
>>>   
>>>> Add support for LPTIMx_OUT triggers that can be found on some STM32
>>>> devices. These triggers can be used then by ADC or DAC.
>>>> Typical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)
>>>> and have synchronised analog conversions with these triggers.
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>  
>>> Given this can't be used as a trigger for other devices (no exposed
>>> interrupt?) I'd expect to see a validate_device callback provided for
>>> the trigger ops.  That would prevent other devices trying to use it.  
>>
>> Hi Jonathan,
>>
>> This is something I had in mind also earlier. Only thing is...
>> Basically, this is limiting: when trigger poll happens on device side
>> (e.g. ADC), another device could use same trigger. But I admit this
>> looks like corner case.
>>
>> I'll add it in next version, with additional patch for ADC part to
>> validate it's a valid device (No DAC yet).
>> I think I'll use INDIO_HARDWARE_TRIGGERED mode:
>> - in adc driver: indio_dev->modes |= INDIO_HARDWARE_TRIGGERED;
>> - in lptimer: if (indio_dev->modes & INDIO_HARDWARE_TRIGGERED)...
> That may not be enough in of itself.  Could be other hardware
> triggered elements on the platform (quite likely with these
> stm parts!)
> 

Hi Jonathan,

As far as I can see, devices supporting it need to check trigger anyway
(e.g. validate_trigger() cb). That is the case currently on stm32-adc
driver. Do you think this "handshake" is okay ?

If not, I can probably add an export symbol instead, in stm32-adc, like:
bool is_stm32_adc_iio_dev(struct iio_dev *indio_dev);
Then use it in validate_device callback.

Please let me know.

Best regards,
Fabrice

> J
>>
>>>
>>> Otherwise, looks good.  
>>
>> Many thanks for your review.
>> Best Regards,
>> Fabrice
>>
>>>
>>> Jonathan  
>>>> ---
>>>> Changes in v2:
>>>> - s/Low Power/Low-Power
>>>> - update few comments
>>>> ---
>>>>  drivers/iio/trigger/Kconfig                   |  11 +++
>>>>  drivers/iio/trigger/Makefile                  |   1 +
>>>>  drivers/iio/trigger/stm32-lptimer-trigger.c   | 110 ++++++++++++++++++++++++++
>>>>  include/linux/iio/timer/stm32-lptim-trigger.h |  24 ++++++
>>>>  4 files changed, 146 insertions(+)
>>>>  create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
>>>>  create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h
>>>>
>>>> diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
>>>> index e4d4e63..a633d2c 100644
>>>> --- a/drivers/iio/trigger/Kconfig
>>>> +++ b/drivers/iio/trigger/Kconfig
>>>> @@ -24,6 +24,17 @@ 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_LPTIMER_TRIGGER
>>>> +	tristate "STM32 Low-Power Timer Trigger"
>>>> +	depends on MFD_STM32_LPTIMER || COMPILE_TEST
>>>> +	help
>>>> +	  Select this option to enable STM32 Low-Power Timer Trigger.
>>>> +	  This can be used as trigger source for STM32 internal ADC
>>>> +	  and/or DAC.
>>>> +
>>>> +	  To compile this driver as a module, choose M here: the
>>>> +	  module will be called stm32-lptimer-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..0a72a2a 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_LPTIMER_TRIGGER) += stm32-lptimer-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-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c
>>>> new file mode 100644
>>>> index 0000000..bcb9aa2
>>>> --- /dev/null
>>>> +++ b/drivers/iio/trigger/stm32-lptimer-trigger.c
>>>> @@ -0,0 +1,110 @@
>>>> +/*
>>>> + * STM32 Low-Power Timer Trigger driver
>>>> + *
>>>> + * Copyright (C) STMicroelectronics 2017
>>>> + *
>>>> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
>>>> + *
>>>> + * License terms:  GNU General Public License (GPL), version 2
>>>> + *
>>>> + * Inspired by Benjamin Gaignard's stm32-timer-trigger driver
>>>> + */
>>>> +
>>>> +#include <linux/iio/iio.h>
>>>> +#include <linux/iio/timer/stm32-lptim-trigger.h>
>>>> +#include <linux/iio/trigger.h>
>>>> +#include <linux/mfd/stm32-lptimer.h>
>>>> +#include <linux/module.h>
>>>> +#include <linux/platform_device.h>
>>>> +
>>>> +/* List Low-Power Timer triggers */
>>>> +static const char * const stm32_lptim_triggers[] = {
>>>> +	LPTIM1_OUT,
>>>> +	LPTIM2_OUT,
>>>> +	LPTIM3_OUT,
>>>> +};
>>>> +
>>>> +struct stm32_lptim_trigger {
>>>> +	struct device *dev;
>>>> +	const char *trg;
>>>> +};
>>>> +
>>>> +static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
>>>> +	.owner = THIS_MODULE,
>>>> +};
>>>> +
>>>> +/**
>>>> + * is_stm32_lptim_trigger
>>>> + * @trig: trigger to be checked
>>>> + *
>>>> + * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger
>>>> + * either return false
>>>> + */
>>>> +bool is_stm32_lptim_trigger(struct iio_trigger *trig)
>>>> +{
>>>> +	return (trig->ops == &stm32_lptim_trigger_ops);
>>>> +}
>>>> +EXPORT_SYMBOL(is_stm32_lptim_trigger);
>>>> +
>>>> +static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)
>>>> +{
>>>> +	struct iio_trigger *trig;
>>>> +
>>>> +	trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg);
>>>> +	if  (!trig)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	trig->dev.parent = priv->dev->parent;
>>>> +	trig->ops = &stm32_lptim_trigger_ops;
>>>> +	iio_trigger_set_drvdata(trig, priv);
>>>> +
>>>> +	return devm_iio_trigger_register(priv->dev, trig);
>>>> +}
>>>> +
>>>> +static int stm32_lptim_trigger_probe(struct platform_device *pdev)
>>>> +{
>>>> +	struct stm32_lptim_trigger *priv;
>>>> +	u32 index;
>>>> +	int ret;
>>>> +
>>>> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
>>>> +	if (!priv)
>>>> +		return -ENOMEM;
>>>> +
>>>> +	if (of_property_read_u32(pdev->dev.of_node, "reg", &index))
>>>> +		return -EINVAL;
>>>> +
>>>> +	if (index >= ARRAY_SIZE(stm32_lptim_triggers))
>>>> +		return -EINVAL;
>>>> +
>>>> +	priv->dev = &pdev->dev;
>>>> +	priv->trg = stm32_lptim_triggers[index];
>>>> +
>>>> +	ret = stm32_lptim_setup_trig(priv);
>>>> +	if (ret)
>>>> +		return ret;
>>>> +
>>>> +	platform_set_drvdata(pdev, priv);
>>>> +
>>>> +	return 0;
>>>> +}
>>>> +
>>>> +static const struct of_device_id stm32_lptim_trig_of_match[] = {
>>>> +	{ .compatible = "st,stm32-lptimer-trigger", },
>>>> +	{},
>>>> +};
>>>> +MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);
>>>> +
>>>> +static struct platform_driver stm32_lptim_trigger_driver = {
>>>> +	.probe = stm32_lptim_trigger_probe,
>>>> +	.driver = {
>>>> +		.name = "stm32-lptimer-trigger",
>>>> +		.of_match_table = stm32_lptim_trig_of_match,
>>>> +	},
>>>> +};
>>>> +module_platform_driver(stm32_lptim_trigger_driver);
>>>> +
>>>> +MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
>>>> +MODULE_ALIAS("platform:stm32-lptimer-trigger");
>>>> +MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver");
>>>> +MODULE_LICENSE("GPL v2");
>>>> diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
>>>> new file mode 100644
>>>> index 0000000..cb795b1
>>>> --- /dev/null
>>>> +++ b/include/linux/iio/timer/stm32-lptim-trigger.h
>>>> @@ -0,0 +1,24 @@
>>>> +/*
>>>> + * Copyright (C) STMicroelectronics 2017
>>>> + *
>>>> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> + *
>>>> + * License terms:  GNU General Public License (GPL), version 2
>>>> + */
>>>> +
>>>> +#ifndef _STM32_LPTIM_TRIGGER_H_
>>>> +#define _STM32_LPTIM_TRIGGER_H_
>>>> +
>>>> +#define LPTIM1_OUT	"lptim1_out"
>>>> +#define LPTIM2_OUT	"lptim2_out"
>>>> +#define LPTIM3_OUT	"lptim3_out"
>>>> +
>>>> +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
>>>> +bool is_stm32_lptim_trigger(struct iio_trigger *trig);
>>>> +#else
>>>> +static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
>>>> +{
>>>> +	return false;
>>>> +}
>>>> +#endif
>>>> +#endif  
>>>   
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1679057 — Re: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver

FromJonathan Cameron <jic23@kernel.org>
Date2017-06-30 20:30 +0200
SubjectRe: [PATCH v2 6/8] iio: trigger: Add STM32 LPTimer trigger driver
Message-ID<tY8Q1-td-13@gated-at.bofh.it>
In reply to#1678980
On Fri, 30 Jun 2017 18:26:56 +0200
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> On 06/30/2017 03:57 PM, Jonathan Cameron wrote:
> > On Mon, 26 Jun 2017 18:41:36 +0200
> > Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> >   
> >> On 06/24/2017 10:13 PM, Jonathan Cameron wrote:  
> >>> On Wed, 21 Jun 2017 16:30:13 +0200
> >>> Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> >>>     
> >>>> Add support for LPTIMx_OUT triggers that can be found on some STM32
> >>>> devices. These triggers can be used then by ADC or DAC.
> >>>> Typical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)
> >>>> and have synchronised analog conversions with these triggers.
> >>>>
> >>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>    
> >>> Given this can't be used as a trigger for other devices (no exposed
> >>> interrupt?) I'd expect to see a validate_device callback provided for
> >>> the trigger ops.  That would prevent other devices trying to use it.    
> >>
> >> Hi Jonathan,
> >>
> >> This is something I had in mind also earlier. Only thing is...
> >> Basically, this is limiting: when trigger poll happens on device side
> >> (e.g. ADC), another device could use same trigger. But I admit this
> >> looks like corner case.
> >>
> >> I'll add it in next version, with additional patch for ADC part to
> >> validate it's a valid device (No DAC yet).
> >> I think I'll use INDIO_HARDWARE_TRIGGERED mode:
> >> - in adc driver: indio_dev->modes |= INDIO_HARDWARE_TRIGGERED;
> >> - in lptimer: if (indio_dev->modes & INDIO_HARDWARE_TRIGGERED)...  
> > That may not be enough in of itself.  Could be other hardware
> > triggered elements on the platform (quite likely with these
> > stm parts!)
> >   
> 
> Hi Jonathan,
> 
> As far as I can see, devices supporting it need to check trigger anyway
> (e.g. validate_trigger() cb). That is the case currently on stm32-adc
> driver. Do you think this "handshake" is okay ?
> 
> If not, I can probably add an export symbol instead, in stm32-adc, like:
> bool is_stm32_adc_iio_dev(struct iio_dev *indio_dev);
> Then use it in validate_device callback.
Anything is fine as long as it guarantees that we can't bind a device to
a trigger it can't use, or the other way around.  You have check from
both sides to prevent other devices using the trigger, or other triggers
being used by the device.  As far as I can see these are tightly coupled.
If there weren't several of them to chose from I'd argue we should drop
the fact the trigger is exposed at all (like we do in quite a few 
devices with a fifo).

J
> 
> Please let me know.
> 
> Best regards,
> Fabrice
> 
> > J  
> >>  
> >>>
> >>> Otherwise, looks good.    
> >>
> >> Many thanks for your review.
> >> Best Regards,
> >> Fabrice
> >>  
> >>>
> >>> Jonathan    
> >>>> ---
> >>>> Changes in v2:
> >>>> - s/Low Power/Low-Power
> >>>> - update few comments
> >>>> ---
> >>>>  drivers/iio/trigger/Kconfig                   |  11 +++
> >>>>  drivers/iio/trigger/Makefile                  |   1 +
> >>>>  drivers/iio/trigger/stm32-lptimer-trigger.c   | 110 ++++++++++++++++++++++++++
> >>>>  include/linux/iio/timer/stm32-lptim-trigger.h |  24 ++++++
> >>>>  4 files changed, 146 insertions(+)
> >>>>  create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c
> >>>>  create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h
> >>>>
> >>>> diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig
> >>>> index e4d4e63..a633d2c 100644
> >>>> --- a/drivers/iio/trigger/Kconfig
> >>>> +++ b/drivers/iio/trigger/Kconfig
> >>>> @@ -24,6 +24,17 @@ 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_LPTIMER_TRIGGER
> >>>> +	tristate "STM32 Low-Power Timer Trigger"
> >>>> +	depends on MFD_STM32_LPTIMER || COMPILE_TEST
> >>>> +	help
> >>>> +	  Select this option to enable STM32 Low-Power Timer Trigger.
> >>>> +	  This can be used as trigger source for STM32 internal ADC
> >>>> +	  and/or DAC.
> >>>> +
> >>>> +	  To compile this driver as a module, choose M here: the
> >>>> +	  module will be called stm32-lptimer-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..0a72a2a 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_LPTIMER_TRIGGER) += stm32-lptimer-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-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c
> >>>> new file mode 100644
> >>>> index 0000000..bcb9aa2
> >>>> --- /dev/null
> >>>> +++ b/drivers/iio/trigger/stm32-lptimer-trigger.c
> >>>> @@ -0,0 +1,110 @@
> >>>> +/*
> >>>> + * STM32 Low-Power Timer Trigger driver
> >>>> + *
> >>>> + * Copyright (C) STMicroelectronics 2017
> >>>> + *
> >>>> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
> >>>> + *
> >>>> + * License terms:  GNU General Public License (GPL), version 2
> >>>> + *
> >>>> + * Inspired by Benjamin Gaignard's stm32-timer-trigger driver
> >>>> + */
> >>>> +
> >>>> +#include <linux/iio/iio.h>
> >>>> +#include <linux/iio/timer/stm32-lptim-trigger.h>
> >>>> +#include <linux/iio/trigger.h>
> >>>> +#include <linux/mfd/stm32-lptimer.h>
> >>>> +#include <linux/module.h>
> >>>> +#include <linux/platform_device.h>
> >>>> +
> >>>> +/* List Low-Power Timer triggers */
> >>>> +static const char * const stm32_lptim_triggers[] = {
> >>>> +	LPTIM1_OUT,
> >>>> +	LPTIM2_OUT,
> >>>> +	LPTIM3_OUT,
> >>>> +};
> >>>> +
> >>>> +struct stm32_lptim_trigger {
> >>>> +	struct device *dev;
> >>>> +	const char *trg;
> >>>> +};
> >>>> +
> >>>> +static const struct iio_trigger_ops stm32_lptim_trigger_ops = {
> >>>> +	.owner = THIS_MODULE,
> >>>> +};
> >>>> +
> >>>> +/**
> >>>> + * is_stm32_lptim_trigger
> >>>> + * @trig: trigger to be checked
> >>>> + *
> >>>> + * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger
> >>>> + * either return false
> >>>> + */
> >>>> +bool is_stm32_lptim_trigger(struct iio_trigger *trig)
> >>>> +{
> >>>> +	return (trig->ops == &stm32_lptim_trigger_ops);
> >>>> +}
> >>>> +EXPORT_SYMBOL(is_stm32_lptim_trigger);
> >>>> +
> >>>> +static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)
> >>>> +{
> >>>> +	struct iio_trigger *trig;
> >>>> +
> >>>> +	trig = devm_iio_trigger_alloc(priv->dev, "%s", priv->trg);
> >>>> +	if  (!trig)
> >>>> +		return -ENOMEM;
> >>>> +
> >>>> +	trig->dev.parent = priv->dev->parent;
> >>>> +	trig->ops = &stm32_lptim_trigger_ops;
> >>>> +	iio_trigger_set_drvdata(trig, priv);
> >>>> +
> >>>> +	return devm_iio_trigger_register(priv->dev, trig);
> >>>> +}
> >>>> +
> >>>> +static int stm32_lptim_trigger_probe(struct platform_device *pdev)
> >>>> +{
> >>>> +	struct stm32_lptim_trigger *priv;
> >>>> +	u32 index;
> >>>> +	int ret;
> >>>> +
> >>>> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> >>>> +	if (!priv)
> >>>> +		return -ENOMEM;
> >>>> +
> >>>> +	if (of_property_read_u32(pdev->dev.of_node, "reg", &index))
> >>>> +		return -EINVAL;
> >>>> +
> >>>> +	if (index >= ARRAY_SIZE(stm32_lptim_triggers))
> >>>> +		return -EINVAL;
> >>>> +
> >>>> +	priv->dev = &pdev->dev;
> >>>> +	priv->trg = stm32_lptim_triggers[index];
> >>>> +
> >>>> +	ret = stm32_lptim_setup_trig(priv);
> >>>> +	if (ret)
> >>>> +		return ret;
> >>>> +
> >>>> +	platform_set_drvdata(pdev, priv);
> >>>> +
> >>>> +	return 0;
> >>>> +}
> >>>> +
> >>>> +static const struct of_device_id stm32_lptim_trig_of_match[] = {
> >>>> +	{ .compatible = "st,stm32-lptimer-trigger", },
> >>>> +	{},
> >>>> +};
> >>>> +MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);
> >>>> +
> >>>> +static struct platform_driver stm32_lptim_trigger_driver = {
> >>>> +	.probe = stm32_lptim_trigger_probe,
> >>>> +	.driver = {
> >>>> +		.name = "stm32-lptimer-trigger",
> >>>> +		.of_match_table = stm32_lptim_trig_of_match,
> >>>> +	},
> >>>> +};
> >>>> +module_platform_driver(stm32_lptim_trigger_driver);
> >>>> +
> >>>> +MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
> >>>> +MODULE_ALIAS("platform:stm32-lptimer-trigger");
> >>>> +MODULE_DESCRIPTION("STMicroelectronics STM32 LPTIM trigger driver");
> >>>> +MODULE_LICENSE("GPL v2");
> >>>> diff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h
> >>>> new file mode 100644
> >>>> index 0000000..cb795b1
> >>>> --- /dev/null
> >>>> +++ b/include/linux/iio/timer/stm32-lptim-trigger.h
> >>>> @@ -0,0 +1,24 @@
> >>>> +/*
> >>>> + * Copyright (C) STMicroelectronics 2017
> >>>> + *
> >>>> + * Author: Fabrice Gasnier <fabrice.gasnier@st.com>
> >>>> + *
> >>>> + * License terms:  GNU General Public License (GPL), version 2
> >>>> + */
> >>>> +
> >>>> +#ifndef _STM32_LPTIM_TRIGGER_H_
> >>>> +#define _STM32_LPTIM_TRIGGER_H_
> >>>> +
> >>>> +#define LPTIM1_OUT	"lptim1_out"
> >>>> +#define LPTIM2_OUT	"lptim2_out"
> >>>> +#define LPTIM3_OUT	"lptim3_out"
> >>>> +
> >>>> +#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)
> >>>> +bool is_stm32_lptim_trigger(struct iio_trigger *trig);
> >>>> +#else
> >>>> +static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)
> >>>> +{
> >>>> +	return false;
> >>>> +}
> >>>> +#endif
> >>>> +#endif    
> >>>     
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >   

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web