Re: [RFC 0/4] iio: trigger: Add OF support and GPIO based trigger

2017-02-18 Thread Jonathan Cameron
On 17/02/17 16:23, Daniel Baluta wrote:
> On Fri, Feb 17, 2017 at 6:03 PM, Fabrice Gasnier  
> wrote:
>> Hi,
>>
>> I send this as an RFC, as I'm digging to try to get as generic
>> as possible GPIO based trigger support, as discussed earlier in
>> other patchset "Add EXTI GPIO trigger support to STM32 ADC":
>> https://www.spinics.net/lists/arm-kernel/msg559091.html
>>
>> Following various comments on this, I sent this RFC to address two
>> topics, that I see as possible prerequisite:
>> - Add trigger OF support
>> - GPIO based trigger
> 
> I wonder if we could use configfs to create and configure
> a GPIO based trigger.
> 
> You should just create another trigger type (look into
> drivers/iio/trigger/iio-trig-hrtimer.c)
> the userspace API will look like this:
> 
> # cd /config/iio/triggers
> # insert your iio-trig-gpio
> # setup the global parameters for the GPIO (the local params can be
> set via dts/acpi)
> # cd /config/iio/trigers/gpios/
> 
> #mkdir t1
> 
> And this will create an io-gpio-trigger named t1.
> 
> Not sure this fits your usecase but would be nice to consider.
> 
It might potentially make sense to support both DT or similar instantiation and
instantiation from userspace. Primary route seems to me to always be DT based
though as we are dealing with wiring...

So I'm unconvinced on the configfs option, but might be talked round.
> thanks,
> Daniel.
> 



Re: [RFC 0/4] iio: trigger: Add OF support and GPIO based trigger

2017-02-18 Thread Jonathan Cameron
On 17/02/17 16:23, Daniel Baluta wrote:
> On Fri, Feb 17, 2017 at 6:03 PM, Fabrice Gasnier  
> wrote:
>> Hi,
>>
>> I send this as an RFC, as I'm digging to try to get as generic
>> as possible GPIO based trigger support, as discussed earlier in
>> other patchset "Add EXTI GPIO trigger support to STM32 ADC":
>> https://www.spinics.net/lists/arm-kernel/msg559091.html
>>
>> Following various comments on this, I sent this RFC to address two
>> topics, that I see as possible prerequisite:
>> - Add trigger OF support
>> - GPIO based trigger
> 
> I wonder if we could use configfs to create and configure
> a GPIO based trigger.
> 
> You should just create another trigger type (look into
> drivers/iio/trigger/iio-trig-hrtimer.c)
> the userspace API will look like this:
> 
> # cd /config/iio/triggers
> # insert your iio-trig-gpio
> # setup the global parameters for the GPIO (the local params can be
> set via dts/acpi)
> # cd /config/iio/trigers/gpios/
> 
> #mkdir t1
> 
> And this will create an io-gpio-trigger named t1.
> 
> Not sure this fits your usecase but would be nice to consider.
> 
It might potentially make sense to support both DT or similar instantiation and
instantiation from userspace. Primary route seems to me to always be DT based
though as we are dealing with wiring...

So I'm unconvinced on the configfs option, but might be talked round.
> thanks,
> Daniel.
> 



Re: [RFC 0/4] iio: trigger: Add OF support and GPIO based trigger

2017-02-17 Thread Daniel Baluta
On Fri, Feb 17, 2017 at 6:03 PM, Fabrice Gasnier  wrote:
> Hi,
>
> I send this as an RFC, as I'm digging to try to get as generic
> as possible GPIO based trigger support, as discussed earlier in
> other patchset "Add EXTI GPIO trigger support to STM32 ADC":
> https://www.spinics.net/lists/arm-kernel/msg559091.html
>
> Following various comments on this, I sent this RFC to address two
> topics, that I see as possible prerequisite:
> - Add trigger OF support
> - GPIO based trigger

I wonder if we could use configfs to create and configure
a GPIO based trigger.

You should just create another trigger type (look into
drivers/iio/trigger/iio-trig-hrtimer.c)
the userspace API will look like this:

# cd /config/iio/triggers
# insert your iio-trig-gpio
# setup the global parameters for the GPIO (the local params can be
set via dts/acpi)
# cd /config/iio/trigers/gpios/

#mkdir t1

And this will create an io-gpio-trigger named t1.

Not sure this fits your usecase but would be nice to consider.

thanks,
Daniel.


Re: [RFC 0/4] iio: trigger: Add OF support and GPIO based trigger

2017-02-17 Thread Daniel Baluta
On Fri, Feb 17, 2017 at 6:03 PM, Fabrice Gasnier  wrote:
> Hi,
>
> I send this as an RFC, as I'm digging to try to get as generic
> as possible GPIO based trigger support, as discussed earlier in
> other patchset "Add EXTI GPIO trigger support to STM32 ADC":
> https://www.spinics.net/lists/arm-kernel/msg559091.html
>
> Following various comments on this, I sent this RFC to address two
> topics, that I see as possible prerequisite:
> - Add trigger OF support
> - GPIO based trigger

I wonder if we could use configfs to create and configure
a GPIO based trigger.

You should just create another trigger type (look into
drivers/iio/trigger/iio-trig-hrtimer.c)
the userspace API will look like this:

# cd /config/iio/triggers
# insert your iio-trig-gpio
# setup the global parameters for the GPIO (the local params can be
set via dts/acpi)
# cd /config/iio/trigers/gpios/

#mkdir t1

And this will create an io-gpio-trigger named t1.

Not sure this fits your usecase but would be nice to consider.

thanks,
Daniel.


[RFC 0/4] iio: trigger: Add OF support and GPIO based trigger

2017-02-17 Thread Fabrice Gasnier
Hi,

I send this as an RFC, as I'm digging to try to get as generic
as possible GPIO based trigger support, as discussed earlier in
other patchset "Add EXTI GPIO trigger support to STM32 ADC":
https://www.spinics.net/lists/arm-kernel/msg559091.html

Following various comments on this, I sent this RFC to address two
topics, that I see as possible prerequisite:
- Add trigger OF support
- GPIO based trigger

Please feel free to advise.
Best Regards.

Fabrice Gasnier (4):
  dt-bindings: iio: introduce trigger providers, consumers
  iio: trigger: add OF support
  dt-bindings: iio: add support for GPIO triggers
  iio: trigger: add GPIO trigger

 .../devicetree/bindings/iio/iio-bindings.txt   |  37 +++
 .../bindings/iio/trigger/iio-trig-gpio.txt |  26 +
 drivers/iio/industrialio-trigger.c | 100 ++
 drivers/iio/trigger/Kconfig|   9 ++
 drivers/iio/trigger/Makefile   |   1 +
 drivers/iio/trigger/iio-trig-gpio.c| 112 +
 include/linux/iio/trigger.h|   4 +
 7 files changed, 289 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/iio/trigger/iio-trig-gpio.txt
 create mode 100644 drivers/iio/trigger/iio-trig-gpio.c

-- 
1.9.1



[RFC 0/4] iio: trigger: Add OF support and GPIO based trigger

2017-02-17 Thread Fabrice Gasnier
Hi,

I send this as an RFC, as I'm digging to try to get as generic
as possible GPIO based trigger support, as discussed earlier in
other patchset "Add EXTI GPIO trigger support to STM32 ADC":
https://www.spinics.net/lists/arm-kernel/msg559091.html

Following various comments on this, I sent this RFC to address two
topics, that I see as possible prerequisite:
- Add trigger OF support
- GPIO based trigger

Please feel free to advise.
Best Regards.

Fabrice Gasnier (4):
  dt-bindings: iio: introduce trigger providers, consumers
  iio: trigger: add OF support
  dt-bindings: iio: add support for GPIO triggers
  iio: trigger: add GPIO trigger

 .../devicetree/bindings/iio/iio-bindings.txt   |  37 +++
 .../bindings/iio/trigger/iio-trig-gpio.txt |  26 +
 drivers/iio/industrialio-trigger.c | 100 ++
 drivers/iio/trigger/Kconfig|   9 ++
 drivers/iio/trigger/Makefile   |   1 +
 drivers/iio/trigger/iio-trig-gpio.c| 112 +
 include/linux/iio/trigger.h|   4 +
 7 files changed, 289 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/iio/trigger/iio-trig-gpio.txt
 create mode 100644 drivers/iio/trigger/iio-trig-gpio.c

-- 
1.9.1