Commit graph

23 commits

Author SHA1 Message Date
Alban Bedel 8e71c04f86 iio:st_sensors: Fix oops when probing SPI devices
In SPI mode the transfer buffer is locked with a mutex. However this
mutex is only initilized after the probe, but some transfer needs to
be done in the probe.

To fix this bug we move the mutex initialization at the beginning of
the device probe.

Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 18:24:08 +01:00
Denis CIOCCA a1dcf42927 iio:pressure: Changed pressure data variable name to press_data
This patch fix pressure data variable name. Usually pdata name
it is used for platform data.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04 11:26:09 +01:00
Denis CIOCCA 0baa3fc1b6 iio:pressure: Removed unnecessary parameter on common_probe function
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04 11:25:38 +01:00
Denis CIOCCA a7ee8839da iio:imu: changed structure name from st_sensors to st_sensor_settings
This patch change structure name and related variables names.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04 11:23:13 +01:00
Jonathan Cameron 2d239c9e92 iio:st sensors: remove custom sampling frequence attribute in favour of core support.
This allows in kernel client drivers to access this

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
2014-07-07 09:39:57 +01:00
Linus Walleij ea7e586bdd iio: st_sensors: move regulator retrieveal to core
Currently the pressure sensor has code to retrieve and enable two
regulators for Vdd and Vdd IO, but actually these voltage inputs
are found on all of these ST sensors, so move the regulator
handling to the core and make sure all the ST sensors call these
functions on probe() and remove() to enable/disable power.

Here also mover over to obtaining the regulator from the *parent*
device of the IIO device, as the IIO device is created on-the-fly
in this very subsystem it very unlikely evert have any regulators
attached to it whatsoever. It is much more likely that the parent
is a platform device, possibly instantiated from a device tree,
which in turn have Vdd and Vdd IO supplied assigned to it.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-26 11:52:42 +01:00
Linus Walleij 4f544ced19 iio: st_sensors: announce registered sensors
It is pretty helpful to know already from dmesg that a certain
device is successfully registered, instead of having to browse
sysfs to see if it's actually there.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-26 11:50:59 +01:00
Denis CIOCCA 931878405b iio:pressure: Add support for LPS25H pressure sensor
This patch adds support for the new barometer sensor: LPS25H.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22 13:09:53 +00: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
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