linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iio: complete the setup of buffer timestamps
@ 2016-07-11 15:24 Alison Schofield
  2016-07-11 15:25 ` [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values Alison Schofield
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Alison Schofield @ 2016-07-11 15:24 UTC (permalink / raw)
  To: jic23
  Cc: tiberiu.a.breana, mranostay, knaack.h, lars, pmeerw, linux-iio,
	linux-kernel

These drivers are using iio_poll_func->timestamp in their triggered buffer
handler as the timestamp pushed to buffer.  Problem is that it was not set up
at probe time via iio_triggered_buffer_setup(), so timestamp is always 0.

Buffer space has been allocated for the timestamp, so it seems to be
wanted.  

These patches make the fix io_triggered_buffer_setup() during probe by
passing the iio_pollfunc_store_time parameter.

Alternative change would be to use iio_get_time_ns() directly in the
push_to_buffers call in the handler.  We can do this if you are not
one of those "devices (who) need a timestamp grabbed as soon as possible
after the trigger" (from iio_poll_func definition)

Either way you are using iio_get_tme_ns(), it's just a question of when.  
Let me know if you'd rather go the slower way.


Alison Schofield (3):
  iio: accel: bma220_spi: set up buffer timestamps for non-zero values
  iio: humidity: am2315: set up buffer timestamps for non-zero values
  iio: proximity: as3935: set up buffer timestamps for non-zero values

 drivers/iio/accel/bma220_spi.c | 2 +-
 drivers/iio/humidity/am2315.c  | 2 +-
 drivers/iio/proximity/as3935.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.1.4

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

* [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values
  2016-07-11 15:24 [PATCH 0/3] iio: complete the setup of buffer timestamps Alison Schofield
@ 2016-07-11 15:25 ` Alison Schofield
  2016-07-11 15:53   ` Breana, Tiberiu A
  2016-07-11 15:26 ` [PATCH 2/3] iio: humidity: am2315: " Alison Schofield
  2016-07-11 15:26 ` [PATCH 3/3] iio: proximity: as3935: " Alison Schofield
  2 siblings, 1 reply; 9+ messages in thread
From: Alison Schofield @ 2016-07-11 15:25 UTC (permalink / raw)
  To: jic23
  Cc: tiberiu.a.breana, mranostay, knaack.h, lars, pmeerw, linux-iio,
	linux-kernel

Use the iio_pollfunc_store_time parameter during triggered buffer
set-up to get valid timestamps.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
---
 drivers/iio/accel/bma220_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
index 1098d10..5099f29 100644
--- a/drivers/iio/accel/bma220_spi.c
+++ b/drivers/iio/accel/bma220_spi.c
@@ -253,7 +253,7 @@ static int bma220_probe(struct spi_device *spi)
 	if (ret < 0)
 		return ret;
 
-	ret = iio_triggered_buffer_setup(indio_dev, NULL,
+	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
 					 bma220_trigger_handler, NULL);
 	if (ret < 0) {
 		dev_err(&spi->dev, "iio triggered buffer setup failed\n");
-- 
2.1.4

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

* [PATCH 2/3] iio: humidity: am2315: set up buffer timestamps for non-zero values
  2016-07-11 15:24 [PATCH 0/3] iio: complete the setup of buffer timestamps Alison Schofield
  2016-07-11 15:25 ` [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values Alison Schofield
@ 2016-07-11 15:26 ` Alison Schofield
  2016-07-11 15:54   ` Breana, Tiberiu A
  2016-07-11 15:26 ` [PATCH 3/3] iio: proximity: as3935: " Alison Schofield
  2 siblings, 1 reply; 9+ messages in thread
From: Alison Schofield @ 2016-07-11 15:26 UTC (permalink / raw)
  To: jic23
  Cc: tiberiu.a.breana, mranostay, knaack.h, lars, pmeerw, linux-iio,
	linux-kernel

Use the iio_pollfunc_store_time parameter during triggered buffer
set-up to get valid timestamps.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
---
 drivers/iio/humidity/am2315.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c
index 3e200f6..ff96b6d 100644
--- a/drivers/iio/humidity/am2315.c
+++ b/drivers/iio/humidity/am2315.c
@@ -244,7 +244,7 @@ static int am2315_probe(struct i2c_client *client,
 	indio_dev->channels = am2315_channels;
 	indio_dev->num_channels = ARRAY_SIZE(am2315_channels);
 
-	ret = iio_triggered_buffer_setup(indio_dev, NULL,
+	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
 					 am2315_trigger_handler, NULL);
 	if (ret < 0) {
 		dev_err(&client->dev, "iio triggered buffer setup failed\n");
-- 
2.1.4

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

* [PATCH 3/3] iio: proximity: as3935: set up buffer timestamps for non-zero values
  2016-07-11 15:24 [PATCH 0/3] iio: complete the setup of buffer timestamps Alison Schofield
  2016-07-11 15:25 ` [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values Alison Schofield
  2016-07-11 15:26 ` [PATCH 2/3] iio: humidity: am2315: " Alison Schofield
@ 2016-07-11 15:26 ` Alison Schofield
  2016-07-24 12:09   ` Jonathan Cameron
  2 siblings, 1 reply; 9+ messages in thread
From: Alison Schofield @ 2016-07-11 15:26 UTC (permalink / raw)
  To: jic23
  Cc: tiberiu.a.breana, mranostay, knaack.h, lars, pmeerw, linux-iio,
	linux-kernel

Use the iio_pollfunc_store_time parameter during triggered buffer
set-up to get valid timestamps.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
---
 drivers/iio/proximity/as3935.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index 2e3a70e..5656deb 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -397,7 +397,7 @@ static int as3935_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	ret = iio_triggered_buffer_setup(indio_dev, NULL,
+	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
 		&as3935_trigger_handler, NULL);
 
 	if (ret) {
-- 
2.1.4

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

* RE: [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values
  2016-07-11 15:25 ` [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values Alison Schofield
@ 2016-07-11 15:53   ` Breana, Tiberiu A
  2016-07-24 12:05     ` Jonathan Cameron
  0 siblings, 1 reply; 9+ messages in thread
From: Breana, Tiberiu A @ 2016-07-11 15:53 UTC (permalink / raw)
  To: Alison Schofield, jic23
  Cc: mranostay, knaack.h, lars, pmeerw, linux-iio, linux-kernel

> -----Original Message-----
> From: Alison Schofield [mailto:amsfield22@gmail.com]
> Sent: Monday, July 11, 2016 6:25 PM
> To: jic23@kernel.org
> Cc: Breana, Tiberiu A <tiberiu.a.breana@intel.com>; mranostay@gmail.com;
> knaack.h@gmx.de; lars@metafoo.de; pmeerw@pmeerw.net; linux-
> iio@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-
> zero values
> 
> Use the iio_pollfunc_store_time parameter during triggered buffer set-up to get
> valid timestamps.	
> 
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>

+1
Reviewed-By: Tiberiu Breana <tiberiu.a.breana@intel.com>

> ---
>  drivers/iio/accel/bma220_spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
> index 1098d10..5099f29 100644
> --- a/drivers/iio/accel/bma220_spi.c
> +++ b/drivers/iio/accel/bma220_spi.c
> @@ -253,7 +253,7 @@ static int bma220_probe(struct spi_device *spi)
>  	if (ret < 0)
>  		return ret;
> 
> -	ret = iio_triggered_buffer_setup(indio_dev, NULL,
> +	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
>  					 bma220_trigger_handler, NULL);
>  	if (ret < 0) {
>  		dev_err(&spi->dev, "iio triggered buffer setup failed\n");
> --
> 2.1.4

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

* RE: [PATCH 2/3] iio: humidity: am2315: set up buffer timestamps for non-zero values
  2016-07-11 15:26 ` [PATCH 2/3] iio: humidity: am2315: " Alison Schofield
@ 2016-07-11 15:54   ` Breana, Tiberiu A
  2016-07-24 12:07     ` Jonathan Cameron
  0 siblings, 1 reply; 9+ messages in thread
From: Breana, Tiberiu A @ 2016-07-11 15:54 UTC (permalink / raw)
  To: Alison Schofield, jic23
  Cc: mranostay, knaack.h, lars, pmeerw, linux-iio, linux-kernel

> -----Original Message-----
> From: Alison Schofield [mailto:amsfield22@gmail.com]
> Sent: Monday, July 11, 2016 6:26 PM
> To: jic23@kernel.org
> Cc: Breana, Tiberiu A <tiberiu.a.breana@intel.com>; mranostay@gmail.com;
> knaack.h@gmx.de; lars@metafoo.de; pmeerw@pmeerw.net; linux-
> iio@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 2/3] iio: humidity: am2315: set up buffer timestamps for non-
> zero values
> 
> Use the iio_pollfunc_store_time parameter during triggered buffer set-up to get
> valid timestamps.
> 
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> ---

+1
Reviewed-By: Tiberiu Breana <tiberiu.a.breana@intel.com>

>  drivers/iio/humidity/am2315.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c
> index 3e200f6..ff96b6d 100644
> --- a/drivers/iio/humidity/am2315.c
> +++ b/drivers/iio/humidity/am2315.c
> @@ -244,7 +244,7 @@ static int am2315_probe(struct i2c_client *client,
>  	indio_dev->channels = am2315_channels;
>  	indio_dev->num_channels = ARRAY_SIZE(am2315_channels);
> 
> -	ret = iio_triggered_buffer_setup(indio_dev, NULL,
> +	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
>  					 am2315_trigger_handler, NULL);
>  	if (ret < 0) {
>  		dev_err(&client->dev, "iio triggered buffer setup failed\n");
> --
> 2.1.4

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

* Re: [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values
  2016-07-11 15:53   ` Breana, Tiberiu A
@ 2016-07-24 12:05     ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2016-07-24 12:05 UTC (permalink / raw)
  To: Breana, Tiberiu A, Alison Schofield
  Cc: mranostay, knaack.h, lars, pmeerw, linux-iio, linux-kernel

On 11/07/16 16:53, Breana, Tiberiu A wrote:
>> -----Original Message-----
>> From: Alison Schofield [mailto:amsfield22@gmail.com]
>> Sent: Monday, July 11, 2016 6:25 PM
>> To: jic23@kernel.org
>> Cc: Breana, Tiberiu A <tiberiu.a.breana@intel.com>; mranostay@gmail.com;
>> knaack.h@gmx.de; lars@metafoo.de; pmeerw@pmeerw.net; linux-
>> iio@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-
>> zero values
>>
>> Use the iio_pollfunc_store_time parameter during triggered buffer set-up to get
>> valid timestamps.	
>>
>> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
>> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> 
> +1
> Reviewed-By: Tiberiu Breana <tiberiu.a.breana@intel.com>
> 
Applied to the fixes-togreg-post-rc1 branch of iio.git
(for my convenience) and marked for stable.

Jonathan
>> ---
>>  drivers/iio/accel/bma220_spi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
>> index 1098d10..5099f29 100644
>> --- a/drivers/iio/accel/bma220_spi.c
>> +++ b/drivers/iio/accel/bma220_spi.c
>> @@ -253,7 +253,7 @@ static int bma220_probe(struct spi_device *spi)
>>  	if (ret < 0)
>>  		return ret;
>>
>> -	ret = iio_triggered_buffer_setup(indio_dev, NULL,
>> +	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
>>  					 bma220_trigger_handler, NULL);
>>  	if (ret < 0) {
>>  		dev_err(&spi->dev, "iio triggered buffer setup failed\n");
>> --
>> 2.1.4
> 

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

* Re: [PATCH 2/3] iio: humidity: am2315: set up buffer timestamps for non-zero values
  2016-07-11 15:54   ` Breana, Tiberiu A
@ 2016-07-24 12:07     ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2016-07-24 12:07 UTC (permalink / raw)
  To: Breana, Tiberiu A, Alison Schofield
  Cc: mranostay, knaack.h, lars, pmeerw, linux-iio, linux-kernel

On 11/07/16 16:54, Breana, Tiberiu A wrote:
>> -----Original Message-----
>> From: Alison Schofield [mailto:amsfield22@gmail.com]
>> Sent: Monday, July 11, 2016 6:26 PM
>> To: jic23@kernel.org
>> Cc: Breana, Tiberiu A <tiberiu.a.breana@intel.com>; mranostay@gmail.com;
>> knaack.h@gmx.de; lars@metafoo.de; pmeerw@pmeerw.net; linux-
>> iio@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: [PATCH 2/3] iio: humidity: am2315: set up buffer timestamps for non-
>> zero values
>>
>> Use the iio_pollfunc_store_time parameter during triggered buffer set-up to get
>> valid timestamps.
>>
>> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
>> Cc: Daniel Baluta <daniel.baluta@gmail.com>
>> ---
> 
> +1
> Reviewed-By: Tiberiu Breana <tiberiu.a.breana@intel.com>
Applied to the fixes-togreg-post-rc1 branch of iio.git and marked for stable.

Thanks,
Jonathan
> 
>>  drivers/iio/humidity/am2315.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c
>> index 3e200f6..ff96b6d 100644
>> --- a/drivers/iio/humidity/am2315.c
>> +++ b/drivers/iio/humidity/am2315.c
>> @@ -244,7 +244,7 @@ static int am2315_probe(struct i2c_client *client,
>>  	indio_dev->channels = am2315_channels;
>>  	indio_dev->num_channels = ARRAY_SIZE(am2315_channels);
>>
>> -	ret = iio_triggered_buffer_setup(indio_dev, NULL,
>> +	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
>>  					 am2315_trigger_handler, NULL);
>>  	if (ret < 0) {
>>  		dev_err(&client->dev, "iio triggered buffer setup failed\n");
>> --
>> 2.1.4
> 
> --
> 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
> 

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

* Re: [PATCH 3/3] iio: proximity: as3935: set up buffer timestamps for non-zero values
  2016-07-11 15:26 ` [PATCH 3/3] iio: proximity: as3935: " Alison Schofield
@ 2016-07-24 12:09   ` Jonathan Cameron
  0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2016-07-24 12:09 UTC (permalink / raw)
  To: Alison Schofield
  Cc: tiberiu.a.breana, mranostay, knaack.h, lars, pmeerw, linux-iio,
	linux-kernel

On 11/07/16 16:26, Alison Schofield wrote:
> Use the iio_pollfunc_store_time parameter during triggered buffer
> set-up to get valid timestamps.
> 
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>
Applied to the fixes-togreg-post-rc1 branch of iio.git and
marked for stable.

Oops to all of these ;)

Jonathan
> ---
>  drivers/iio/proximity/as3935.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
> index 2e3a70e..5656deb 100644
> --- a/drivers/iio/proximity/as3935.c
> +++ b/drivers/iio/proximity/as3935.c
> @@ -397,7 +397,7 @@ static int as3935_probe(struct spi_device *spi)
>  		return ret;
>  	}
>  
> -	ret = iio_triggered_buffer_setup(indio_dev, NULL,
> +	ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
>  		&as3935_trigger_handler, NULL);
>  
>  	if (ret) {
> 

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

end of thread, other threads:[~2016-07-24 12:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11 15:24 [PATCH 0/3] iio: complete the setup of buffer timestamps Alison Schofield
2016-07-11 15:25 ` [PATCH 1/3] iio: accel: bma220_spi: set up buffer timestamps for non-zero values Alison Schofield
2016-07-11 15:53   ` Breana, Tiberiu A
2016-07-24 12:05     ` Jonathan Cameron
2016-07-11 15:26 ` [PATCH 2/3] iio: humidity: am2315: " Alison Schofield
2016-07-11 15:54   ` Breana, Tiberiu A
2016-07-24 12:07     ` Jonathan Cameron
2016-07-11 15:26 ` [PATCH 3/3] iio: proximity: as3935: " Alison Schofield
2016-07-24 12:09   ` 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).