linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: st_pressure: Fix data sign
@ 2016-12-12 16:58 Marcin Niestroj
  2016-12-12 16:58 ` [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap Marcin Niestroj
  2016-12-13  8:51 ` [PATCH 1/2] iio: st_pressure: Fix data sign Linus Walleij
  0 siblings, 2 replies; 6+ messages in thread
From: Marcin Niestroj @ 2016-12-12 16:58 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Gregor Boirie, Linus Walleij, linux-iio, Marcin Niestroj

Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that
the pressure and temperature data is a 2's complement.

Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver")
Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor")
Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor")
Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
 drivers/iio/pressure/st_pressure_core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 55df9a7..44e46c1 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -227,7 +227,7 @@ static const struct iio_chan_spec st_press_1_channels[] = {
 		.address = ST_PRESS_1_OUT_XL_ADDR,
 		.scan_index = 0,
 		.scan_type = {
-			.sign = 'u',
+			.sign = 's',
 			.realbits = 24,
 			.storagebits = 32,
 			.endianness = IIO_LE,
@@ -240,7 +240,7 @@ static const struct iio_chan_spec st_press_1_channels[] = {
 		.address = ST_TEMP_1_OUT_L_ADDR,
 		.scan_index = 1,
 		.scan_type = {
-			.sign = 'u',
+			.sign = 's',
 			.realbits = 16,
 			.storagebits = 16,
 			.endianness = IIO_LE,
@@ -259,7 +259,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {
 		.address = ST_PRESS_LPS001WP_OUT_L_ADDR,
 		.scan_index = 0,
 		.scan_type = {
-			.sign = 'u',
+			.sign = 's',
 			.realbits = 16,
 			.storagebits = 16,
 			.endianness = IIO_LE,
@@ -273,7 +273,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = {
 		.address = ST_TEMP_LPS001WP_OUT_L_ADDR,
 		.scan_index = 1,
 		.scan_type = {
-			.sign = 'u',
+			.sign = 's',
 			.realbits = 16,
 			.storagebits = 16,
 			.endianness = IIO_LE,
@@ -291,7 +291,7 @@ static const struct iio_chan_spec st_press_lps22hb_channels[] = {
 		.address = ST_PRESS_1_OUT_XL_ADDR,
 		.scan_index = 0,
 		.scan_type = {
-			.sign = 'u',
+			.sign = 's',
 			.realbits = 24,
 			.storagebits = 32,
 			.endianness = IIO_LE,
-- 
2.10.2

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

* [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap
  2016-12-12 16:58 [PATCH 1/2] iio: st_pressure: Fix data sign Marcin Niestroj
@ 2016-12-12 16:58 ` Marcin Niestroj
  2016-12-13  8:52   ` Linus Walleij
  2016-12-13  8:51 ` [PATCH 1/2] iio: st_pressure: Fix data sign Linus Walleij
  1 sibling, 1 reply; 6+ messages in thread
From: Marcin Niestroj @ 2016-12-12 16:58 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Gregor Boirie, Linus Walleij, linux-iio, Marcin Niestroj

Both devices are using the same iio_chan_spec to define which settings
are exported with sysfs. Both are properly configured to set/get
sampling frequency for pressure and temperature. They also properly
export available sampling frequencies. The only missing thing is
sampling_frequency sysfs file, which allows to set/get this property
from userspace.

Add sampling frequency to iio channel info mask, so sampling_frequency
file is properly exported using sysfs.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
 drivers/iio/pressure/st_pressure_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 44e46c1..fd4dcf1 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -234,6 +234,7 @@ static const struct iio_chan_spec st_press_1_channels[] = {
 		},
 		.info_mask_separate =
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
+		.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
 	},
 	{
 		.type = IIO_TEMP,
@@ -249,6 +250,7 @@ static const struct iio_chan_spec st_press_1_channels[] = {
 			BIT(IIO_CHAN_INFO_RAW) |
 			BIT(IIO_CHAN_INFO_SCALE) |
 			BIT(IIO_CHAN_INFO_OFFSET),
+		.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
 	},
 	IIO_CHAN_SOFT_TIMESTAMP(2)
 };
-- 
2.10.2


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

* Re: [PATCH 1/2] iio: st_pressure: Fix data sign
  2016-12-12 16:58 [PATCH 1/2] iio: st_pressure: Fix data sign Marcin Niestroj
  2016-12-12 16:58 ` [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap Marcin Niestroj
@ 2016-12-13  8:51 ` Linus Walleij
  2016-12-30 11:33   ` Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2016-12-13  8:51 UTC (permalink / raw)
  To: Marcin Niestroj
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Gregor Boirie, linux-iio@vger.kernel.org

On Mon, Dec 12, 2016 at 5:58 PM, Marcin Niestroj
<m.niestroj@grinn-global.com> wrote:

> Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that
> the pressure and temperature data is a 2's complement.
>
> Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver")
> Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor")
> Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor")
> Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support")
> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>

Looks correct. I guess noone thought of testing negative pressures :/

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap
  2016-12-12 16:58 ` [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap Marcin Niestroj
@ 2016-12-13  8:52   ` Linus Walleij
  2016-12-30 11:34     ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2016-12-13  8:52 UTC (permalink / raw)
  To: Marcin Niestroj
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Gregor Boirie, linux-iio@vger.kernel.org

On Mon, Dec 12, 2016 at 5:58 PM, Marcin Niestroj
<m.niestroj@grinn-global.com> wrote:

> Both devices are using the same iio_chan_spec to define which settings
> are exported with sysfs. Both are properly configured to set/get
> sampling frequency for pressure and temperature. They also properly
> export available sampling frequencies. The only missing thing is
> sampling_frequency sysfs file, which allows to set/get this property
> from userspace.
>
> Add sampling frequency to iio channel info mask, so sampling_frequency
> file is properly exported using sysfs.
>
> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 1/2] iio: st_pressure: Fix data sign
  2016-12-13  8:51 ` [PATCH 1/2] iio: st_pressure: Fix data sign Linus Walleij
@ 2016-12-30 11:33   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2016-12-30 11:33 UTC (permalink / raw)
  To: Linus Walleij, Marcin Niestroj
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Gregor Boirie, linux-iio@vger.kernel.org

On 13/12/16 08:51, Linus Walleij wrote:
> On Mon, Dec 12, 2016 at 5:58 PM, Marcin Niestroj
> <m.niestroj@grinn-global.com> wrote:
> 
>> Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that
>> the pressure and temperature data is a 2's complement.
>>
>> Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver")
>> Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor")
>> Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor")
>> Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support")
>> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
> 
> Looks correct. I guess noone thought of testing negative pressures :/
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
I've applied to the togreg branch of iio.git - initially pushed out as testing
because the very nature of a fix for multiple previous patches will make it tricky
to apply to older kernels.

If you want to do backports after it has gone into mainline, they'll be most
welcome.

Thanks,

Jonathan
> 
> Yours,
> Linus Walleij
> 


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

* Re: [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap
  2016-12-13  8:52   ` Linus Walleij
@ 2016-12-30 11:34     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2016-12-30 11:34 UTC (permalink / raw)
  To: Linus Walleij, Marcin Niestroj
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Gregor Boirie, linux-iio@vger.kernel.org

On 13/12/16 08:52, Linus Walleij wrote:
> On Mon, Dec 12, 2016 at 5:58 PM, Marcin Niestroj
> <m.niestroj@grinn-global.com> wrote:
> 
>> Both devices are using the same iio_chan_spec to define which settings
>> are exported with sysfs. Both are properly configured to set/get
>> sampling frequency for pressure and temperature. They also properly
>> export available sampling frequencies. The only missing thing is
>> sampling_frequency sysfs file, which allows to set/get this property
>> from userspace.
>>
>> Add sampling frequency to iio channel info mask, so sampling_frequency
>> file is properly exported using sysfs.
>>
>> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Yours,
> Linus Walleij
> 
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.

Thanks,

Jonathan

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

end of thread, other threads:[~2016-12-30 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-12 16:58 [PATCH 1/2] iio: st_pressure: Fix data sign Marcin Niestroj
2016-12-12 16:58 ` [PATCH 2/2] iio: st_pressure: Export sampling frequency for lps25h and lps331ap Marcin Niestroj
2016-12-13  8:52   ` Linus Walleij
2016-12-30 11:34     ` Jonathan Cameron
2016-12-13  8:51 ` [PATCH 1/2] iio: st_pressure: Fix data sign Linus Walleij
2016-12-30 11:33   ` 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).