linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: st_common: use standard trigger suffix
@ 2015-08-05  9:28 Linus Walleij
  2015-08-05 20:15 ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2015-08-05  9:28 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio; +Cc: Linus Walleij, Denis Ciocca

The triggers from ST sensors are named <iio_device_name>-trigger
instead of the standard <iio_device_name>-dev<iio_dev_id> as
used by most and also in the iio-tools. Change this to match
the norm.

After this I can do tests with generic_buffer -n <dev_name>
without having to manually specify the trigger with the -t
option.

Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/iio/common/st_sensors/st_sensors_trigger.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c
index 3e907040c2c7..3c0aa17d753f 100644
--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
@@ -24,7 +24,8 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
 	int err;
 	struct st_sensor_data *sdata = iio_priv(indio_dev);
 
-	sdata->trig = iio_trigger_alloc("%s-trigger", indio_dev->name);
+	sdata->trig = iio_trigger_alloc("%s-dev%d",
+					indio_dev->name, indio_dev->id);
 	if (sdata->trig == NULL) {
 		err = -ENOMEM;
 		dev_err(&indio_dev->dev, "failed to allocate iio trigger.\n");
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: st_common: use standard trigger suffix
  2015-08-05  9:28 [PATCH] iio: st_common: use standard trigger suffix Linus Walleij
@ 2015-08-05 20:15 ` Jonathan Cameron
  2015-08-06 15:03   ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2015-08-05 20:15 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Cameron, linux-iio; +Cc: Denis Ciocca



On 5 August 2015 10:28:15 BST, Linus Walleij <linus.walleij@linaro.org> wrote:
>The triggers from ST sensors are named <iio_device_name>-trigger
>instead of the standard <iio_device_name>-dev<iio_dev_id> as
>used by most and also in the iio-tools. Change this to match
>the norm.
>
>After this I can do tests with generic_buffer -n <dev_name>
>without having to manually specify the trigger with the -t
>option.
Hmm ABI change... Not a requirement that this naming be followed...

Could register the trigger twice I suppose so as to keep old name available.... 


>
>Cc: Denis Ciocca <denis.ciocca@st.com>
>Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>---
> drivers/iio/common/st_sensors/st_sensors_trigger.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c
>b/drivers/iio/common/st_sensors/st_sensors_trigger.c
>index 3e907040c2c7..3c0aa17d753f 100644
>--- a/drivers/iio/common/st_sensors/st_sensors_trigger.c
>+++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c
>@@ -24,7 +24,8 @@ int st_sensors_allocate_trigger(struct iio_dev
>*indio_dev,
> 	int err;
> 	struct st_sensor_data *sdata = iio_priv(indio_dev);
> 
>-	sdata->trig = iio_trigger_alloc("%s-trigger", indio_dev->name);
>+	sdata->trig = iio_trigger_alloc("%s-dev%d",
>+					indio_dev->name, indio_dev->id);
> 	if (sdata->trig == NULL) {
> 		err = -ENOMEM;
> 		dev_err(&indio_dev->dev, "failed to allocate iio trigger.\n");

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: st_common: use standard trigger suffix
  2015-08-05 20:15 ` Jonathan Cameron
@ 2015-08-06 15:03   ` Linus Walleij
  2015-08-06 16:39     ` Jonathan Cameron
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Linus Walleij @ 2015-08-06 15:03 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, linux-iio@vger.kernel.org, Denis Ciocca

On Wed, Aug 5, 2015 at 10:15 PM, Jonathan Cameron
<jic23@jic23.retrosnub.co.uk> wrote:
> On 5 August 2015 10:28:15 BST, Linus Walleij <linus.walleij@linaro.org> wrote:
>>
>>The triggers from ST sensors are named <iio_device_name>-trigger
>>instead of the standard <iio_device_name>-dev<iio_dev_id> as
>>used by most and also in the iio-tools. Change this to match
>>the norm.
>>
>>After this I can do tests with generic_buffer -n <dev_name>
>>without having to manually specify the trigger with the -t
>>option.
>
> Hmm ABI change... Not a requirement that this naming be followed...

Unless someone can provide a userspace that actually have the
ST sensors working (with mainline) I think we can make this change.

I've really struggled to get generic_buffer going with the ST sensors
to no avail. Right now it seems to be because the *_en files in
/scan_elements are not ever written with "1" so consequently
iio_buffer_store_enable
__iio_update_buffers
iio_buffer_request_update
iio_buffer_update_bytes_per_datum

Doesn't happen and bytes per datum is zero and it bails out.

I don't know if it's a problem with generic_buffer though, is there
another userspace that everyone is using without telling me?

> Could register the trigger twice I suppose so as to keep old name available....

Hm there are a couple of more actually using -trigger if there is a
single one.

Maybe we should have generic_buffer looking for both rather, or
do you want to keep that tool simple?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: st_common: use standard trigger suffix
  2015-08-06 15:03   ` Linus Walleij
@ 2015-08-06 16:39     ` Jonathan Cameron
  2015-08-06 18:59     ` Lars-Peter Clausen
  2015-09-20 10:58     ` Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2015-08-06 16:39 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Jonathan Cameron, linux-iio@vger.kernel.org, Denis Ciocca



On 6 August 2015 16:03:56 BST, Linus Walleij <linus.walleij@linaro.org> wrote:
>On Wed, Aug 5, 2015 at 10:15 PM, Jonathan Cameron
><jic23@jic23.retrosnub.co.uk> wrote:
>> On 5 August 2015 10:28:15 BST, Linus Walleij
><linus.walleij@linaro.org> wrote:
>>>
>>>The triggers from ST sensors are named <iio_device_name>-trigger
>>>instead of the standard <iio_device_name>-dev<iio_dev_id> as
>>>used by most and also in the iio-tools. Change this to match
>>>the norm.
>>>
>>>After this I can do tests with generic_buffer -n <dev_name>
>>>without having to manually specify the trigger with the -t
>>>option.
>>
>> Hmm ABI change... Not a requirement that this naming be followed...
>
>Unless someone can provide a userspace that actually have the
>ST sensors working (with mainline) I think we can make this change.
>
>I've really struggled to get generic_buffer going with the ST sensors
>to no avail. Right now it seems to be because the *_en files in
>/scan_elements are not ever written with "1" so consequently
>iio_buffer_store_enable
>__iio_update_buffers
>iio_buffer_request_update
>iio_buffer_update_bytes_per_datum
>
>Doesn't happen and bytes per datum is zero and it bails out.
>
>I don't know if it's a problem with generic_buffer though, is there
>another userspace that everyone is using without telling me?
Documentation problem rather than anything else. Those need setting manually
prior to run as adding a configurable interface to enable them in generic buffer
 is way too fiddly.
>
>> Could register the trigger twice I suppose so as to keep old name
>available....
>
>Hm there are a couple of more actually using -trigger if there is a
>single one.
>
>Maybe we should have generic_buffer looking for both rather, or
>do you want to keep that tool simple?
No objection to the little bit of extra code that would need.
>
>Yours,
>Linus Walleij

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: st_common: use standard trigger suffix
  2015-08-06 15:03   ` Linus Walleij
  2015-08-06 16:39     ` Jonathan Cameron
@ 2015-08-06 18:59     ` Lars-Peter Clausen
  2015-09-20 10:58     ` Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2015-08-06 18:59 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Cameron
  Cc: Jonathan Cameron, linux-iio@vger.kernel.org, Denis Ciocca

On 08/06/2015 05:03 PM, Linus Walleij wrote:
[..]
> I don't know if it's a problem with generic_buffer though, is there
> another userspace that everyone is using without telling me?

Try libiio[1] and the iio_readdev[2] tool or the IIO scope[3].

- Lars

[1] https://github.com/analogdevicesinc/libiio
[2] https://github.com/analogdevicesinc/libiio/blob/master/tests/iio_readdev.c
[3] https://github.com/analogdevicesinc/iio-oscilloscope

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] iio: st_common: use standard trigger suffix
  2015-08-06 15:03   ` Linus Walleij
  2015-08-06 16:39     ` Jonathan Cameron
  2015-08-06 18:59     ` Lars-Peter Clausen
@ 2015-09-20 10:58     ` Jonathan Cameron
  2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2015-09-20 10:58 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Cameron; +Cc: linux-iio@vger.kernel.org, Denis Ciocca

On 06/08/15 16:03, Linus Walleij wrote:
> On Wed, Aug 5, 2015 at 10:15 PM, Jonathan Cameron
> <jic23@jic23.retrosnub.co.uk> wrote:
>> On 5 August 2015 10:28:15 BST, Linus Walleij <linus.walleij@linaro.org> wrote:
>>>
>>> The triggers from ST sensors are named <iio_device_name>-trigger
>>> instead of the standard <iio_device_name>-dev<iio_dev_id> as
>>> used by most and also in the iio-tools. Change this to match
>>> the norm.
>>>
>>> After this I can do tests with generic_buffer -n <dev_name>
>>> without having to manually specify the trigger with the -t
>>> option.
>>
>> Hmm ABI change... Not a requirement that this naming be followed...
> 
> Unless someone can provide a userspace that actually have the
> ST sensors working (with mainline) I think we can make this change.
> 
> I've really struggled to get generic_buffer going with the ST sensors
> to no avail. Right now it seems to be because the *_en files in
> /scan_elements are not ever written with "1" so consequently
> iio_buffer_store_enable
> __iio_update_buffers
> iio_buffer_request_update
> iio_buffer_update_bytes_per_datum
> 
> Doesn't happen and bytes per datum is zero and it bails out.
> 
> I don't know if it's a problem with generic_buffer though, is there
> another userspace that everyone is using without telling me?
> 
>> Could register the trigger twice I suppose so as to keep old name available....
> 
> Hm there are a couple of more actually using -trigger if there is a
> single one.
> 
> Maybe we should have generic_buffer looking for both rather, or
> do you want to keep that tool simple?
> 
sorry Linus, I completely failed to come back to you on this.
I'd have no problem with generic-buffer looking for both as long
as the code is commented to say the 'unusual' one is not
the preferred choice and is for legacy parts.

I guess we also need some documentation to specify preferred naming
of triggers.  As Lars pointed out the various libraries out there
tend to deal with these cases anyway (often by navigating the sysfs
tree to find associated triggers provided by a given device).

Jonathan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-20 10:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05  9:28 [PATCH] iio: st_common: use standard trigger suffix Linus Walleij
2015-08-05 20:15 ` Jonathan Cameron
2015-08-06 15:03   ` Linus Walleij
2015-08-06 16:39     ` Jonathan Cameron
2015-08-06 18:59     ` Lars-Peter Clausen
2015-09-20 10:58     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).