aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/pressure/ms5611_core.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-01-21iio: pressure: ms5611: claim direct mode during oversampling changesAlison Schofield1-5/+7
Driver was checking for direct mode before changing oversampling ratios, but was not locking it. Use the claim/release helper functions to guarantee the device stays in direct mode while the oversampling ratios are being updated. Continue to use the drivers private state lock to protect against conflicting direct mode access of the state data. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: ms65611_core: Fixes dereferencing regulator pointerCrt Mori1-11/+8
Change in handling of the regulator description means that static checkers correctly assume we could be using dereferenced pointer to the regulator. In reality we will never get the -ENODEV error, as current behavior flow does not predict it, because: If the device tree or board file does not define suitable regulators for the component, it will be substituted by a dummy regulator, or, if regulators are disabled altogether, by stubs. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-05iio: fetch and enable regulators unconditionallyCrt Mori1-4/+2
This patch is inspired by a comment of Jonathan Cameron on patch of Linus Walleij commit aeb55fff3891834e07a3144159a7298a19696af8 ("iio: st_sensors: fetch and enable regulators unconditionally"). The explanation for this change is same as in that patch: "Supplies are *not* optional (optional means that the supply is optional in the electrical sense, not the software sense) so we need to get the and enable them at all times. If the device tree or board file does not define suitable regulators for the component, it will be substituted by a dummy regulator, or, if regulators are disabled altogether, by stubs. There is no need to use the IS_ERR_OR_NULL() check that is considered harmful. Reported-by: Linus Wallerij <linus.walleij@linaro.org> Suggested-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie1-1/+2
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow userspace to select a particular POSIX clock for buffered samples and events timestamping. Following clocks, as listed in clock_gettime(2), are supported: CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and CLOCK_TAI. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16iio: pressure: ms5611: use tab for indentionJonathan Cameron1-1/+1
This fixes the errors reported by checkpatch.pl: ERROR: code indent should use tabs where possible Signed-off-by: Slawomir Stepien <sst@poczta.fm> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio:pressure:ms5611: fix missing regulator_disableGregor Boirie1-9/+32
Ensure optional regulator is properly disabled when present. Fixes: 3145229f9191 ("iio:pressure:ms5611: power regulator support") Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05iio:pressure:ms5611: oversampling rate supportGregor Boirie1-2/+103
Add support for setting and retrieving OverSampling Rate independently for each of the temperature and pressure channels. This allows userspace to fine tune hardware sampling process according to the following tradeoffs : * the higher the OSR, the finer the resolution ; * the higher the OSR, the lower the noise ; BUT: * the higher the OSR, the larger the drift ; * the higher the OSR, the longer the response time, i.e. less samples per unit of time. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio:pressure:ms5611: power regulator supportGrégor Boirie1-0/+13
Add support for an optional regulator which, if found into device-tree, will power on device at probing time. The regulator is declared into ms5611 DTS entry as a "vdd-supply" property. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio:pressure:ms5611: use probed device nameGrégor Boirie1-2/+3
Use name of probed device instead of driver's one when registering device. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio:pressure:ms5611: fix ms5607 temp compensationGregor Boirie1-6/+6
Computation of sens2 was wrong and is fixed by this patch, sens2 should be: 2 * (t - 2000)^2 See page 8 of ms5607 datasheet here: http://www.meas-spec.com/product/pressure/MS5607-02BA03.aspx Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Lucas De Marchi <lucas.demarchi@intel.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-06iio: pressure: ms5611: Add triggered buffer supportDaniel Baluta1-2/+72
This will be used together with an external trigger (e.g hrtimer based software trigger). Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-06iio: pressure: ms5611: Add IIO_CHAN_INFO_SCALE to maskDaniel Baluta1-2/+16
This allows data exported via buffer interface to be converted to standard units in userspace. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-05iio: pressure: ms5611: add support for MS5607 temperature and pressure sensorTomasz Duszynski1-10/+66
MS5607 is temperature and pressure sensor which hardware is similar to MS5611. Both sensors share command protocol and support both I2C and SPI serial protocols. They only differ in compensation algorithms. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-05iio: pressure: ms5611: remove IIO_CHAN_INFO_SCALE from maskTomasz Duszynski1-4/+2
IIO_CHAN_INFO_SCALE is useful whenever conversion to standard units is done in userspace. In this case conversion is handled by driver so this bit is unnecessary. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-15iio: pressure: add support for MS5611 pressure and temperature sensorTomasz Duszynski1-0/+215
Add support for Measurement Specialities MS5611 pressure and temperature sensor. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>