Commit graph

21 commits

Author SHA1 Message Date
Peter Meerwald cc26ad455f iio: Add Freescale MPL3115A2 pressure / temperature sensor driver
I2C-controlled MEMS sensor with 20-bit pressure measurement (pascal) and
12-bit temperature measurement

driver only exposes basic functionality, see TODO remarks
datasheet: http://cache.freescale.com/files/sensors/doc/data_sheet/MPL3115A2.pdf

v2:
* store 20-bit value in 32-bit buffer element (instead of 24-bit)
* zero buffer to prevent kernel data leak to userspace
* fix mutex unlock in trigger handler (thanks Andi Shyti)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:13 +00:00
Denis CIOCCA d141ab776b iio:pressure: Adds LPS001WP support also on spi interface and Kconfig fix
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:55:14 +01:00
Lars-Peter Clausen 6c0743ed99 iio:st_pressure: Remove redundant call to iio_sw_buffer_preenable().
The equivalent of iio_sw_buffer_preenable() is now done in the IIO buffer core,
so there is no need to do this from the driver anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-16 19:13:56 +01:00
Lee Jones 71e1980c8d iio: pressure-core: st: Provide support for the Vdd_IO power supply
The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd_IO power supply to be specified by either platform data or
Device Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-23 20:17:58 +01:00
Lee Jones 774487611c iio: pressure-core: st: Provide support for the Vdd power supply
The power to some of the sensors are controlled by regulators. In most
cases these are 'always on', but if not they will fail to work until
the regulator is enabled using the relevant APIs. This patch allows for
the Vdd power supply to be specified by either platform data or Device
Tree.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-23 20:17:54 +01:00
Denis CIOCCA 7a137c9c40 iio:press: Register buffer also without specific trigger
This patch fix buffer registration that allows to use generic IIO trigger.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 19:24:09 +01:00
Lee Jones 7885a8ce68 iio: pressure: st: Add support for new LPS001WP pressure sensor
Here we use existing practices to introduce support for another
pressure/temperature sensor, the LPS001WP.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 19:24:05 +01:00
Lee Jones a6cc5b250c iio: pressure-core: st: Clean-up probe() function
This patch contains some pretty basic clean-ups in probe() pertaining to
the simplification of error handling and a couple of readability adaptions.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 19:24:05 +01:00
Lee Jones 38d1c6a911 iio: sensors-core: st: Support sensors which don't have a Data Ready pin
Not all ST's sensors support data ready, so let's make the declaration
of one conditional.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21 19:24:03 +01:00
Lee Jones ea01f2c18a iio: pressure-core: st: Allow for number of channels to vary
At the moment the number of channels specified is dictated by the first
sensor supported by the driver. As we add support for more sensors this
is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's
channel specifier we'll use a new adaptable 'struct st_sensors' element
instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14 21:17:17 +01:00
Lee Jones 2f5effcbd0 iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
Due to the MACRO used, the task of reading, understanding and maintaining
the LPS331AP's channel descriptor is substantially difficult. This patch
is based on the view that it's better to have easy to read, maintainable
code than to save a few lines here and there. For that reason we're
expanding the array so initialisation is completed in full.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14 21:17:17 +01:00
Lee Jones 302fbd50ef iio: pressure-core: st: Describe LPS331AP defines by name
They're currently named *_1_*, for 'Sensor 1', but the code will be much
more readable if we use the naming convention *_LPS331AP_* instead.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14 21:17:16 +01:00
Lee Jones 362f2f8647 iio: sensors-core: st: Allow full-scale to be an optional feature
Some chips either don't support it or fail to provide adequate documentation,
so sometimes it's impossible to enable the feature even if it is supported.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14 21:17:15 +01:00
Sachin Kamat d0fe8c8b3b iio: pressure: st_pressure: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 21:02:38 +01:00
Jacek Anaszewski 1003eb67ba iio: lps331ap: Modify in_temp_scale calculation way
This patch modifies the way how the in_temp_scale output value is
calculated. With this implementation it is more clear how the value
is obtained.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 19:00:27 +01:00
Lars-Peter Clausen 3edc84e605 iio: Add a comment to about alphabetical order to Kconfigs and Makefiles
Keeping Makefile and Kconfig entries in alphabetical order usually works better
than just appending new entries at the end, since it reduces the amount of
conflicts. This patch adds a comment to the IIO Kconfig and Makefile files to
document that the entries should be kept in alphabetical order.

Also reorder those  entries which weren't in alphabetical order yet.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:36 +01:00
Peter Meerwald 341673f141 iio: reword help text of several IIO_ST drivers
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: "Denis Ciocca" <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:30 +01:00
Peter Meerwald 93232cd564 iio: fix Kconfig typos
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:29 +01:00
Denis CIOCCA 23cde4d65c iio: Added ST-sensors platform data to select the DRDY interrupt pin
This patch add support to redirect the DRDY interrupt on INT1 or INT2
on accelerometer and pressure sensors.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:28 +01:00
Jacek Anaszewski 67dbf54a3b iio: lps331ap: Fix wrong in_pressure_scale output value
This patch fixes improper in_pressure_scale output that is
returned by the lps331ap barometer sensor driver. According
to the documentation the pressure after applying the scale has to
be expressed in kilopascal units. With erroneous implementation
the scale value larger by two orders of magnitude is returned -
2441410 instead of 24414.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-07-16 08:51:57 +01:00
Denis CIOCCA 217494e5b7 iio:pressure: Add STMicroelectronics pressures driver
This patch adds a generic pressure driver for STMicroelectronics
pressure sensors, currently it supports: LPS331AP.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-06-05 18:41:23 +01:00