mbox series

[v1,0/2] iio: Add parent_trigger attribute to triggers

Message ID 1486390912-24362-1-git-send-email-benjamin.gaignard@st.com
Headers show
Series iio: Add parent_trigger attribute to triggers | expand

Message

Benjamin Gaignard Feb. 6, 2017, 2:21 p.m. UTC
Thoses patches add parent_trigger attribute to IIO triggers.
The goal is to allow triggers to use triggers like is this done for iio
devices.
With this patch it will be possible to chain triggers, for example
stm32 triggers could be used as clock of an other triggers:
echo "tim1_trgo" > trigger0/parent_trigger.

Similary to what already exist to validate a device, a new (optional) 
validate_trigger function is added in iio_trigger structure and should be
filled by drivers.

Benjamin Gaignard (2):
  iio: Allow triggers to be used as parent of others triggers
  iio: stm32 trigger: Implement validate_trigger function

 .../ABI/testing/sysfs-bus-iio-timer-stm32          |  26 ++++++
 .../ABI/testing/sysfs-bus-iio-trigger-sysfs        |   8 ++
 drivers/iio/industrialio-trigger.c                 |  68 ++++++++++++++
 drivers/iio/trigger/stm32-timer-trigger.c          | 104 +++++++++++++++++++++
 include/linux/iio/trigger.h                        |   6 +-
 5 files changed, 211 insertions(+), 1 deletion(-)

-- 
1.9.1

Comments

Lars-Peter Clausen Feb. 6, 2017, 2:26 p.m. UTC | #1
On 02/06/2017 03:21 PM, Benjamin Gaignard wrote:
> Thoses patches add parent_trigger attribute to IIO triggers.

> The goal is to allow triggers to use triggers like is this done for iio

> devices.

> With this patch it will be possible to chain triggers, for example

> stm32 triggers could be used as clock of an other triggers:

> echo "tim1_trgo" > trigger0/parent_trigger.


Can you explain how this is different to assigning the parent_trigger
directly to the device?
Benjamin Gaignard Feb. 6, 2017, 2:43 p.m. UTC | #2
2017-02-06 15:26 GMT+01:00 Lars-Peter Clausen <lars@metafoo.de>:
> On 02/06/2017 03:21 PM, Benjamin Gaignard wrote:

>> Thoses patches add parent_trigger attribute to IIO triggers.

>> The goal is to allow triggers to use triggers like is this done for iio

>> devices.

>> With this patch it will be possible to chain triggers, for example

>> stm32 triggers could be used as clock of an other triggers:

>> echo "tim1_trgo" > trigger0/parent_trigger.

>

> Can you explain how this is different to assigning the parent_trigger

> directly to the device?

>


It is the same but done on trigger structure without need to have an iio device.

While writing stm32 trigger driver Jonathan explain me that I can't use an iio
device without channel to chain my hardware blocks.
Since my hardware allows to chain triggers, Jonathan suggest to create this
parent_trigger attribute to ab able to link the triggers.
Jonathan Cameron Feb. 11, 2017, 10:23 a.m. UTC | #3
On 06/02/17 14:43, Benjamin Gaignard wrote:
> 2017-02-06 15:26 GMT+01:00 Lars-Peter Clausen <lars@metafoo.de>:

>> On 02/06/2017 03:21 PM, Benjamin Gaignard wrote:

>>> Thoses patches add parent_trigger attribute to IIO triggers.

>>> The goal is to allow triggers to use triggers like is this done for iio

>>> devices.

>>> With this patch it will be possible to chain triggers, for example

>>> stm32 triggers could be used as clock of an other triggers:

>>> echo "tim1_trgo" > trigger0/parent_trigger.

>>

>> Can you explain how this is different to assigning the parent_trigger

>> directly to the device?

>>

> 

> It is the same but done on trigger structure without need to have an iio device.

> 

> While writing stm32 trigger driver Jonathan explain me that I can't use an iio

> device without channel to chain my hardware blocks.

> Since my hardware allows to chain triggers, Jonathan suggest to create this

> parent_trigger attribute to ab able to link the triggers.

> 

I think Lars was looking for the more general explanation.  How does
one trigger drive another one?  What does that mean?